Consider the following three classes, where C inherits from A and B, and the method m() is present in both A and B.


class A(object):
def m(self):
print "a.m"

class B(object):
def m(self):
print "b.m"

class C(A, B):
def test(self):
pass

Now, if you create an instance of class C and invoke method m, what will be the result?


>>> c = C()
>>> c.m()
a.m

The Python docs tutorial on the subject says "the resolution rule used for class attribute references (...) is depth-first, left-to-right.", which seems like an easy rule. However, it also warns about some maintenance nightmares, e.g "a class derived from two classes that happen to have a common base class".