[Python-3000] super() PEP (original) (raw)

Guido van Rossum guido at python.org
Tue May 1 01:10:45 CEST 2007


On 4/30/07, Lino Mastrodomenico <l.mastrodomenico at gmail.com> wrote:

2007/4/30, Tim Delaney <tcdelaney at optusnet.com.au>: > Fine with me. Calvin - want to send me your latest draft, and I'll do some > modifications? I think we've got to the point now where we can take this > off-list.

One more thing: what do people think of modifying super so that when it doesn't find a method instead of raising AttributeError it returns something like "lambda *args, **kwargs: None"? Optionally this can be a constant (e.g. defaultmethod) defined somewhere so, if necessary, it's still possible to detect if the value of super.meth is a real method or the "fake" defaultmethod. I think this can be useful when a method doesn't know if it's the last in the MRO because it may depend on the inheritance hierarchy of its subclasses: you can always simply call super.meth(...) and if the current method is the last this will be a NOP.

Most definitely not. If you don't even know whether you're defining or overriding a method you shouldn't be using super in the first place, because you're obviously not engaged in cooperative MI.

And don't get me started abut init. Constructors don't do cooperative MI, period.

-- --Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-3000 mailing list