Guido's new method definition idea

James Stroud jstroud at mbi.ucla.edu
Fri Dec 5 23:35:07 EST 2008


Daniel Fetchinson wrote:
> 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

> 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

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?

James



More information about the Python-list mailing list