Python multiple inheritance: How super() follows the MRO

Python multiple inheritance: How super() follows the MRO

Python class C inherits from (A, B), and both A.__init__ and B.__init__ invoke super().__init__().

We run C(). It prints “B, A”. How does B.__init__ run? A doesn’t inherit from B.

The answer: super() looks at the MRO of C, not A.

B isn’t in A.__mro__. But it is in C.__mro__.