Use __init()__ on super() inside the constructor of the subclass to invoke the constructor of the superclass in Python. In inheritance invoking the super constructor of a subclass invokes the constructor of its superclass.
Python calls the super constructor example
Simple example code use super() to invoke the super constructor
class SuperClass():
def __init__(self):
print("Super Constructor")
class SubClass(SuperClass):
def __init__(self):
super().__init__()
print("Subclass Constructor")
print(SubClass())
Output:
Do comment if you have any doubts or suggestions on this Python constructor tutorial.
Note: IDE: PyCharm 2021.3.3 (Community Edition)
Windows 10
Python 3.10.1
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.