Python ProgrammingPython Programming

What does super do in Python?

In a class hierarchy with single inheritance, super can be used to refer to parent classes without naming them explicitly, thus making the code more maintainable. This use closely parallels the use of super in other programming languages.
class A(object):
    def __init__(self, profession):
        print(profession)
 
 
class B(A):
    def __init__(self):
        print('John Doe')
        super().__init__('Developer')
 
 
b = B()
 
Sample output of above program.
John Doe
Developer