Guido's new method definition idea

Daniel Fetchinson fetchinson at googlemail.com
Sat Dec 6 16:49:40 EST 2008


>> Hi folks,
>>
>> The story of the explicit self in method definitions has been
>> discussed to death and we all know it will stay. However, Guido
>> himself acknowledged that an alternative syntax makes perfect sense
>> and having both (old and new) in a future version of python is a
>> possibility since it maintains backward compatibility. The alternative
>> syntax will be syntactic sugar for the old one. This blog post of his
>> is what I'm talking about:
>>
>> http://neopythonic.blogspot.com/2008/10/why-explicit-self-has-to-stay.html
>>
>> The proposal is to allow this:
>>
>> class C:
>>     def self.method( arg ):
>>         self.value = arg
>>         return self.value
>>
>> instead of this:
>>
>> class C:
>>     def method( self, arg ):
>>         self.value = arg
>>         return self.value
>>
> (snip)
>> I'd like this new way of defining methods, what do you guys think?
>
> -1
>
> As far as I'm concerned, it doesn't add anything to the language, nor
> doesn't save any typing, so I just don't see the point. And having it
> co-existing with the normal syntax will only add more confusion.

It doesn't add anything but makes something that exists a bit clearer
and friendlier to newbies. Saving typing was never the intention.

> NB : FWIW, I would eventually have voted -0 if it had been proposed for
> Python 3, and as a _replacement_ (not _alternative_) to the current
> syntax. But Python 3 is now released, so...

There will be python 4000 eventually :)

-- 
Psss, psss, put it down! - http://www.cafepress.com/putitdown



More information about the Python-list mailing list