When ‘super’ is not a good idea

Jean-Michel Pichavant jeanmichel at sequans.com
Wed Oct 7 16:11:48 CEST 2009

alex23 wrote:
> Jean-Michel Pichavant <jeanmic... at sequans.com> wrote:
>> a possible answer:
>> - explicit >> implicit
>> I'm not sure this is the correct one though :)
> To me, the explicit reference to the base class violates DRY. It also
> means you need to manually change all such references should the base
> class ever change, something that using super() avoids.
I found the correct answer 

" super is perhaps the trickiest Python construct: this series aims to 
unveil its secrets"

"Having established that super cannot return the mythical superclass, we 
may ask ourselves what the hell it is returning ;) The truth is that 
super returns proxy objects.Informally speaking, a proxy is an object 
with the ability to dispatch to methods of other objects via delegation. 
Technically, super is a class overriding the __getattribute__ method. 
Instances of super are proxy objects providing access to the methods in 
the MRO."


More information about the Python-list mailing list