I have tried to run the following code:
class A(object):
def __init__(self, a):
super(A, self).__init__()
print('A')
class B(object):
def __init__(self, b):
super(B, self).__init__()
print('B')
class C(A, B):
def __init__(self, a, b):
A.__init__(self, a)
B.__init__(self, b)
print('C')
sim = C(a=1,b=2)
And I get the following error message that I don't understand:
Traceback (most recent call last):
File "<string>", line 19, in <module>
File "<string>", line 15, in __init__
File "<string>", line 3, in __init__
TypeError: __init__() missing 1 required positional argument: 'b'
In line 3, I call the constructor of the object class that doesn't require any input argument. It seems that Python in line 3 is trying to call the constructor of B. Why?