in Python 2 there are two ways to call a method inherited from a parent class. With super where it is explicit that the methods is from the parent class and without super.
class Parent(object):
def greet(self):
print('Hello from Parent')
class Child(Parent):
def __init__(self):
super(Child, self).__init__()
def hello(self):
print('Hello from Child')
self.greet()
super(Child, self).greet()
child = Child()
child.hello()
Outputs:
Hello from Child
Hello from Parent
Hello from Parent
Which is the preferred one? I see the community suggests the invocation through super, but without super the call is much more concise.
The question is intended for Python 2 only.