Why aren't all the base classes constructors being called?
<p>In Python 2.7.10</p>

<pre><code>class OneMixin(object):
    def __init__(self):
        # super(OneMixin, self).__init__()
        print "one mixin"

class TwoMixin(object):
    def __init__(self):
        # super(TwoMixin, self).__init__()
        print "two mixin"

class Account(OneMixin, TwoMixin):
    def __init__(self):
        super(Account, self).__init__()
        print "account"
</code></pre>

<p>The Account.mro() is: <code>[&lt;class 'Account'&gt;, &lt;class 'OneMixin'&gt;, &lt;class 'TwoMixin'&gt;, &lt;type 'object'&gt;]</code></p>

<p>Although every class is listed in the MRO, "two mixin" is not printed.</p>

<p>If I uncomment the super calls in OneMixin and TwoMixin, the MRO is exactly the same, but the "two mixin" IS printed.</p>

<p>Why the difference?  I would expect every thing in the MRO to be called.</p>

<p>The reason is that you're overriding the <code>__init__</code> method of the parent class.  The method resolution order will be the same, regardless of what is in your <code>__init__</code> method.</p>

<p>The way <code>super</code> works is that it will pass it down to the next class down the line in the method resolution order. By commenting out that line in <code>OneMixin</code>, you break the chain. <code>super</code> is designed for <strong>cooperative</strong> inheritance. </p>

<p>Also, <code>__init__</code> is not truly a class constructor, either. This may trip you up if you think of it as you would a constructor in other languages.</p>

python python-2.7