[Python-3000] Removing 'self' from method definitions

Josiah Carlson jcarlson at uci.edu
Thu Apr 13 20:36:43 CEST 2006


Ian Bicking <ianb at colorstudy.com> wrote:
> 
> OK, so first Guido says he wants people to speculate less, then he says 
> he wants them to speculate more.  Who knows.  So, now I speculate more.
> 
> I propose that the self argument be removed from method definitions.  It 
> would not be removed from other places, e.g., you'd still use 
> "self.foo()", but the definition for that method would be "def foo():".

-1 Why?  Because right now the various methods on a class have obvious
signature-specific clues as to what they are: instance method (has a
leading self), class method (has a leading cls or klass generally),
static method (has no leading self, cls, etc.) .  Removing self (and
possibly even cls if one goes a step farther) ambiguates what kind of
method a function definition is, from a signature standpoint.  As was
said in the decorator discussion; signatures are important and should be
grepable (that along with readability is why we didn't see decorators
_inside_ the signature).  By removing the _explicit_ self, we make
instance methods generally undifferentiatable (is that a word?) from a
grep standpoint.

 - Josiah



More information about the Python-3000 mailing list