If I've got three classes like this:
class BaseClass(object):
def __init__(self, base_arg, base_arg2=None):
...
class MixinClass(object):
def __init__(self, mixin_arg):
...
class ChildClass(BaseClass, MixinClass):
def __init__(self, base_arg, mixin_arg, base_arg2=None):
???
What is the correct way to initialize MixinClass
and BaseClass
?
It doesn't look like I can use super
because the MixinClass
and the BaseClass
both accept different arguments… And two calls, MixinClass.__init__(...)
and BaseClass.__init__(...)
, will could cause the diamond inheritence problem super
is designed to prevent.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…