[Python-3000] Removing 'self' from method definitions
Greg Ewing
greg.ewing at canterbury.ac.nz
Sun Apr 16 06:11:16 CEST 2006
Ian Bicking wrote:
> Class.some_method(self, blah) seems like a corner case. How often do
> you do that?
Very frequently, when calling inherited __init__ methods.
> If it is calling a superclass method, then super(Class,
> self).some_method() should be used
That's a matter of opinion. In the case of __init__
methods, most of the time it simply doesn't work,
because different __init__ methods rarely have the
same signature.
In other cases, so far in my code I've found exactly
zero use cases for super(). I've considered using it
a couple of times, but changed my mind when I realised
that it wouldn't do what I wanted, and it was better
to redesign my inheritance hierarchy so that I could
use plain inherited calls instead.
So I would never tell anyone that they "should" be
using super().
--
Greg
More information about the Python-3000
mailing list