Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Fri Jul 30 23:07:25 EDT 2010


On Sat, 31 Jul 2010 14:25:39 +1200, Gregory Ewing wrote:

> Steven D'Aprano wrote:
> 
>>       A
>>      / \
>>     C   B
>>      \ /
>>       D
>>      / \
>>     E   F
>> 
>> Yes, a super call might jog left from C to B, but only when being
>> called from one of the lower classes D-F. That's still an upwards call
>> relative to the originator, not sidewards.
> 
> But it's not an upward call relative to the class mentioned in the
> super() call, which is why I say it's misleading.

Which class would that be?

I think I'm going to need an example that demonstrates what you mean, 
because I can't make heads or tails of it. Are you suggesting that a call 
to super(C, self).method() from within C might call B.method(self)?


-- 
Steven



More information about the Python-list mailing list