Say I have a base class (MyBase) which has an __init__
method
I also have 2 mixins. Each of these mixins has a single attribute, and a couple of methods, but none of the methods or attributes are common in the two mixins.
MyBaseClass, mixin1, and mixin2 all inherit from object
I want to derive a class (MyRealClass) from the mixins (mixin1 and mixin2) and from MyBase.
From what I saw on MRO, the correct definition of MyRealClass would be
class MyRealClass(mixin1, mixin2, MyBase):
MyRealClass has a do_init method (I want to control when I initialize certain parts of the class, but MyBase has an __init__
method.
My question is, in the mixins, should I have an __init__
method in them?
Can you explain why they should? I don't need to do any work in the init for either mixin for my class.
Thanks