william tanksley a écrit :
On Dec 5, 6:21 pm, "Daniel Fetchinson" <[EMAIL PROTECTED]>
wrote:
I'd like this new way of defining methods, what do you guys think?
Anyone ready for writing a PEP?

I think it's an awesome proposal. It's about time! With this change,
defining methods uses the same special syntax hack that calling them
does.

except that self doesn't exist when the method is defined. Or, should I say, when the function is defined - because that's really a function. It only becomes a method when looked up on the class (either directly or thru an instance), thanks to the descriptor protocol (hint : there's *no* "syntax hack" involved when calling inst.method - just partial evaluation). IOW : this def self.stuff thing only empeds correct understanding of Python's object model.

(snip)

I see a lot of people are against it; I admit that it's not the status
quo, but that's not a sufficient argument against a change (it defeats
all possible changes). A more interesting argument against it is that
it's special "implicit" syntax; but I would argue that it merely
reflects the existing special syntax of method calls.

Once again, there's *nothing* like an "existing special syntax of method calls". Just the use of the descriptor protocol (the very same mechanism that's powers properties) and partial application. I've already described this more than once in details in this newsgroup FWIW.

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to