I am curious why this code:
class BaseClassA(object):
def __init__(self):
print('A1')
# super().__init__()
print('A2')
class BaseClassB(object):
def __init__(self):
print('B1')
# super().__init__()
print('B2')
class ChildClass(BaseClassA, BaseClassB):
pass
c = ChildClass()
Prints:
A1
A2
And not (as I was expecting):
A1
A2
B1
B2
Now if you uncomment those two lines containing call to __init__() from super class you will get:
A1
B1
B2
A2
Which seems for me like super().__init__() called from BaseClassA calls __init__() from BaseClassB. Can you explain this strange behavior to me?
Edit: I saw this question, but I still don't know why __init__ method of one base class (A) influences call of __init__ from another base class (B)