Guido's new method definition idea
James Stroud
jstroud at mbi.ucla.edu
Sat Dec 6 02:57:41 EST 2008
Steven D'Aprano wrote:
> On Fri, 05 Dec 2008 20:35:07 -0800, James Stroud wrote:
>> Daniel Fetchinson wrote:
>>> I'd like this new way of defining methods, what do you guys think?
>> Consider the maverick who insists on
>>
>> class C:
>> def me.method(arg):
>> self.value = arg
>
> Replace "self" with "me".
Yes, I corrected myself one minute after I made the typo.
>> which should be equivalent to
>>
>> class C:
>> def method(me, arg):
>> me.value = arg
>>
>> What's the interpreter going to do with our maverick's code?
>
> I don't see why you think this is a problem.
The behavior was unspecified as far as I could tell and I was curious as
to whether "me" would still be allowed as a reference to self. Allowing
alternatives to "self" would maintain backwards compatibility as the use
of self has been a convention and not enforced by the language.
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com
More information about the Python-list
mailing list