>>> class A(object):
... def save(self):
... print("a")
...
>>> class B(object):
... def b(self):
... print("b")
...
>>> class B(A):
... def b(self):
... print("b")
...
>>> class C(A):
... def save(self):
... print("c")
>>> class D(B,C):
... def d(self):
... print("d")
...
>>> d = D()
>>> d.save()
c
>>> class E(C,B):
... def e(self):
... print("e")
...
>>> class F(D,E):
... def f(self):
... print("f")
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Error when calling the metaclass bases
Cannot create a consistent method resolution
order (MRO) for bases C, B
class A:
def save(self):
print("a")
def a(self):
print("a")
class B(A):
def b(self):
print (b)
class C(A):
def save(self):
print("c")
def c(self):
print("c")
class D(B,C):
def d(self):
print("d")
class E(C,B):
def e(self):
print("e")
>>> b = B()
>>> b.save()
a
>>> d = D()
>>> d.save()
c
>>> class F(D, E):
... def f(self):
... print("f")
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Cannot create a consistent method resolution
order (MRO) for bases B, C
class A:
def save(self):
print("a")
def a(self):
print("a")
class B(A):
def b(self):
print (b)
class C(A):
def save(self):
print("c")
def c(self):
print("c")
class D(B,C):
def d(self):
print("d")
class E(C,B):
def e(self):
print("e")
class F(D, E):
def f(self):
print("f")
>>> b = B()
>>> b.save()
a
>>> d = D()
>>> d.save()
a
>>> f = F()
>>> f.save()
a