I am an absolutely Python beginner and don't understand the problem of the following lines.
class Base:
def __init__(self, x):
print("Base")
self.x = x
class A(Base):
def __init__(self):
super(A, self).__init__(1)
print("A")
class B(Base):
def __init__(self):
super(B, self).__init__(2)
print("B")
class C(A, B):
def __init__(self):
super(C, self).__init__()
print("C")
if __name__ == '__main__':
c = C()
I think super calls looking from C init in the following order: A-B-Base-Base or am I wrong?
Thank you for your answers.
Use the below code:
class A(Base):
def __init__(self):
super(A, self).__init__() #Remove this 1
print("A")
I hope it may help you.