15 Apr
2011
15 Apr
'11
7:48 p.m.
Mark Shannon wrote:
class A: pass class B(A): pass class C(A,B):pass
Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: Cannot create a consistent method resolution order (MRO) for bases B, A
All right, but this is okay: class C(B, A): pass
Michael Foord wrote:
For a super call in C, B is a sibling to A. For a super call in B, A is a parent.
With the semantics I was suggesting if C calls super, but A doesn't then B would still get called.
which is contradicted by:
"Siblings", in the context of a single MRO are thus classes between which there is no sub-class/super-class relation.
So I maintain that the situation is far from clear. :-) -- Greg