[Python-Dev] python and super
Michael Foord
fuzzyman at voidspace.org.uk
Fri Apr 15 15:30:11 CEST 2011
On 15/04/2011 02:02, Greg Ewing wrote:
> Michael Foord wrote:
>> What I was suggesting is that a method not calling super shouldn't
>> stop a *sibling* method being called, but could still prevent the
>> *parent* method being called.
>
> There isn't necessarily a clear distinction between parents
> and siblings.
>
> class A:
> ...
>
> class B(A):
> ...
>
> class C(A, B):
> ...
>
> In C, is A a parent of B or a sibling of B?
>
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.
All the best,
Michael
--
http://www.voidspace.org.uk/
May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing http://www.sqlite.org/different.html
More information about the Python-Dev
mailing list