Assume I have two classes
class A:
def __init__(self, v1, v2):
self.v1 = v1
self.v2 = v2
class B:
def __init__(self):
self.v = 'something'
and a subclass that inherits both and needs to call both constructors (that have different arguments):
class C(A, B):
def __init__(self, v1, v2):
# Is the following correct?
A.__init__(self, v1, v2)
B.__init__(self)
Is the above the correct way to do that? Or is there a way to exploit super()
even when the __init__
arguments of the superclasses do not match?