print 'mixin a'
print 'mixin b'
class Top(MixinB, MixinA, Base):
t = Top()
(<class 'Top'>, <class 'MixinB'>, <class 'MixinA'>, <class 'Base'>, <type 'object'>)
super() does not 'try' each class in the MRO. Your code chains the calls, because each method called has another
super() call in it.
super().m(), which resolves to
MixinB.m(); which in turn uses
super() again, etc.
mixin a is printed before
mixin b because you are printing after the
super() call, so the last element in the MRO is executed first. The
super() call is just another method call, so a
super().m() call has completed.
Your MRO is as follows:
>>> type(t).__mro__ (<class '__main__.Top'>, <class '__main__.MixinB'>, <class '__main__.MixinA'>, <class '__main__.Base'>, <type 'object'>)
Base.m() is called last and gets to print first, followed by
Top being the last to print.
Note that the MRO of
self is used, not of the class you pass into
super() as the first argument; the MRO is thus stable throughout all calls in your hierarchy for any given instance.
If you expected the print statements to be executed in the order the MRO calls are chained, you'll have to put the
m() method in the MRO.