MRO Error on Multiple Inheritance?

Ming minger at gmail.com
Fri Jan 4 21:03:35 CET 2008


I'm working through Wesley Chun's CPP2e and got this error on 13.11.1,
pp 548 where his interpreter snippet shows no problems:

ActivePython 2.5.1.1 (ActiveState Software Inc.) b
Python 2.5.1 (r251:54863, May  1 2007, 17:47:05) [
win32
Type "help", "copyright", "credits" or "license" f
>>> class A(object): pass
...
>>> class B(A): pass
...
>>> class C(B): pass
...
>>> class D(A, B): pass
...
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 A, B

(I submitted the problem to the author but I'm not sure I'll ever hear
back.)  I'm guessing that this kind of diamond inheritance is
prohibited by the interpreter, and that his lack of error messages
from the interpretation is due to actually leaving out the "class
B(A): pass"  Can someone shed light?  Thanks.



More information about the Python-list mailing list