In Python, how do I pick which Parent's method to call? Say I want to call the parent ASDF2's __init__
method. Seems like I have to specify ASDF1 in the super()..? And if I want to call ASDF3's __init__
, then I must specify ASDF2?!
>>> class ASDF(ASDF1, ASDF2, ASDF3):
def __init__(self):
super(ASDF1, self).__init__()
>>> ASDF()
ASDF2's __init__ happened
>>> class ASDF(ASDF1, ASDF2, ASDF3):
def __init__(self):
super(ASDF2, self).__init__()
>>> ASDF()
ASDF3's __init__ happened
Seems bonkers to me. What am I doing wrong?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…