When you call
super().func(...)
, the first implementation of
func()
found in the ancestor classes according to the Method Resolution Order is executed. Other implementations are ignored. In your case,
a.__init__()
is found and
b.__init__()
is ignored.
You could call the method explicitly
class c(a,b):
def __init__(self):
print('this is c')
super().__init__() # or a.__init__(self)
b.__init__(self)
Multiple inheritance occurs rarely. When it occurs some classes are usually «mixin» classes and they don't have an
__init__
method. So typically, "a" would be a mixin class without such a method and "b" would have an
__init__
method, which would be called by
super().__init__()
.
For user defined classes, it is customary to capitalize the class name, so use A, B, C...