I am having a bit trouble understanding python's mro(Method resolution order). Python operates from left to right. So as per my understanding the order of calling for M should be. M, B, A, Z, X, Y
class X: pass
class Y: pass
class Z: pass
class A(X,Y): pass
class B(Y,Z): pass
class M(B,A,Z): pass
print(M.mro())
But the correct order of calling is.
[<class '__main__.M'>,
<class '__main__.B'>,
<class '__main__.A'>,
<class '__main__.X'>,
<class '__main__.Y'>,
<class '__main__.Z'>,
<class 'object'>]
Can anyone explain the ordering and help me understand this. Thank you