[Level 3] Method Resolution Order in Python

If you want to know the ordering of the method, you can check from __mro__.
Ex.
>>> class c11(object):
...   pass
...
>>> class c12(object):
...   pass
...
>>> class c21(object):
...   pass
...
>>> class c22(object):
...   pass
...
>>> class c1(c11,c12):
...   pass
...
>>> class c2(c21,c22):
...   pass
...
>>> class c(c1,c2):
...   pass
...
>>> c.__mro__
(, , , , , , , )
>>>

Wish this helps.
regards,
Stanley Huang

Comments

Popular posts from this blog

[Level 2] Shell Interactive With Zenity Episode 5 -- list

[Level 2] iif in Python