在Python中,如何选择调用哪个Parent的方法?假设我想调用父ASDF2的__init__
方法。似乎我必须指定ASDF1在超()..?如果我想打电话给ASDF3的__init__
,那么我必须指定ASDF2?!Python的多重继承:选择要调用哪个super()
>>> 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
对我来说似乎是疯狂的。我究竟做错了什么?