Python super() Function
Instance
Create a class that inherits all methods and properties from another class:
class Parent: def __init__(self, txt): self.message def printmessage(self): print(self.message) class Child(Parent): def __init__(self, txt): super().__init__(txt) x = Child("Hello, and welcome!") x.printmessage()
Definition and Usage
The super() function is used to provide access to methods and properties of the superclass or sibling class.
The super() function returns an object representing the superclass.
Syntax
super()
Parameter Value
No Parameters