[Python-3000] super(): issues [Was: Removing 'self' from method definitions]

Nick Coghlan ncoghlan at gmail.com
Wed Apr 19 11:08:31 CEST 2006


Giovanni Bajo wrote:
> Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> 
>> The use case for super() is where you have a chain of
>> methods that are sufficiently compatible that you don't
>> need to know or care which one you're calling next.
>> That's not usually the case with __init__ methods.
> 
> It worked fine for me when I forced my clients (for a specific hierarchy) to
> always pass keyword arguments to __init__. This allowed me to use super()
> succesfully. Of course, Python non-existing support for mandatory keyword
> arguments makes things a little harder than they could be.
> 
> I'll also point people to this page, which contains a very accurate description
> of the issues with super:
> http://fuhm.net/super-harmful/

Hmm, the reference to Dylan's next method (along with a few other comments in 
this thread) makes me believe a magic autosuper() equivalent would really need 
to be based on a thread-local context, rather than any kind of static code 
analysis.

An interesting point is that being able to call the "next method" for generic 
functions has exactly the same problem.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-3000 mailing list