Method Resolution Order in case of Base Classes Having different init params

前端 未结 5 1218
刺人心
刺人心 2021-01-20 05:52

I am trying to understand MRO in Python. Although there are various posts here, I am not particularly getting what I want. Consider two classes A and B

5条回答
  •  情深已故
    2021-01-20 06:11

    I believe you can't use super for this. You'll have to use the "old style":

    class C(A,B):
        def __init__(self, something, anotherthing, someOtherThing):
            A.__init__(self, something, anotherthing)
            B.__init__(self, someOtherThing)
    

提交回复
热议问题