Daniel Fetchinson a écrit :
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.

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...
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to