class A
and class B
are part of class C
, I separate them for the single responsibility principle, so I inherit them in class C, they need different variables for initialization, I faced error when using super().__init__(b=b, d=d)
class A:
def __init__(self, a):
print(f"A is init param={a}")
class B:
def __init__(self, b, d):
print(f"B is init param={b} {d}")
class C(A, B):
def __init__(self, a, b, d):
super().__init__(a=a)
super().__init__(b=b, d=d)
c = C(a=3, b=5, d=9)
I got error:
super().__init__(b=5, d=9)
TypeError: A.__init__() got an unexpected keyword argument 'b'
A is init param=3
How can I inherit both class A
and class B
while initialize them with different variables?