[Python-Dev] python and super (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Sat Apr 16 01:48:54 CEST 2011
- Previous message: [Python-Dev] python and super
- Next message: [Python-Dev] python and super
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Mark Shannon wrote:
class A: pass class B(A): pass class C(A,B):pass Traceback (most recent call last): File "", line 1, in 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
- Previous message: [Python-Dev] python and super
- Next message: [Python-Dev] python and super
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]