Using python 2.7 with new class style, if my class inherits from Object
class, what is the behavior of super(ClassName, self).__init__()
? What I mean is, what happens behind the scenes ? What is the difference if I omitted it ?
An example above:
class ClassName(object):
"""docstring for ClassName"""
def __init__(self, arg):
super(ClassName, self).__init__() ## The question above is about this super
self.arg = arg
class OtherClass(ClassName):
"""docstring for OtherClass"""
def __init__(self, arg, otherArg):
super(OtherClass, self).__init__(arg) ## The question below is about this super
self.otherArg = otherArg
If I omit the super
, what is the happens behind the scenes ?
Thanks.