Python Super Method

super() is a built-in method which is useful to call the super class constructor or methods from the sub class. Any constructor written in the super class is not available to the sub class if the sub class has a constructor. Then how can we initialize the super class instance variables and use them in the sub class? This is done by calling the super class constructor using the super() method from inside the sub class constructor. super() is a built-in method in Python that contains the history of super class methods.Hence, we can use super() to refer to super class constructor and methods from a sub class. So super() can be used as:



A Python program to call the super class constructor in the sub class using super().


A Python program to access base class constructor and method in the sub class using super().