class x(object):
def __init__(self):
self.x=1
class z(object):
def __init__(self):
self.z=1
class y(x,z):
def __init__(self):
super(y, self).__init__()
And what is it doing "super" function in here?
It calls x.__init__():
class x(object):
def __init__(self):
print ("x.__init__()")
self.x=1
class z(object):
def __init__(self):
print ("z.__init__()")
self.z=1
class y(x,z):
def __init__(self):
super(y, self).__init__()
y()
"""my output -->
x.__init__()
"""
Super is not very useful. Call x.__init__() directly.
Reputation Points: 930
Solved Threads: 666
Posting Maven
Offline 2,655 posts
since Jul 2008