[Python-Dev] Decorator syntax (original) (raw)
Erik Bray hyugaricdeau at gmail.com
Wed Sep 2 18:06:34 CEST 2009
- Previous message: [Python-Dev] Decorator syntax
- Next message: [Python-Dev] Decorator syntax
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, Sep 2, 2009 at 10:35 AM, James Y Knight<foom at fuhm.net> wrote:
On Sep 2, 2009, at 6:15 AM, Rob Cliffe wrote:
So - the syntax restriction seems not only inconsistent, but pointless; it doesn't forbid anything, but merely means we have to do it in a slightly convoluted (unPythonesque) way. So please, Guido, will you reconsider? Indeed, it's a silly inconsistent restriction. When it was first added I too suggested that any expression be allowed after the @, rather than having a uniquely special restricted syntax. I argued from consistency of grammar standpoint. But Guido was not persuaded. Good luck to you. :) Here's some of the more relevant messages from the thread back when the @decorator feature was first introduced: http://mail.python.org/pipermail/python-dev/2004-August/046654.html http://mail.python.org/pipermail/python-dev/2004-August/046659.html http://mail.python.org/pipermail/python-dev/2004-August/046675.html http://mail.python.org/pipermail/python-dev/2004-August/046711.html http://mail.python.org/pipermail/python-dev/2004-August/046741.html http://mail.python.org/pipermail/python-dev/2004-August/046753.html http://mail.python.org/pipermail/python-dev/2004-August/046818.html
I think Guido may have a point about not allowing any arbitrary expression. But I do think that if it allows calls, it should also at least support the itemgetter syntax, for which there seems to be a demonstrable use case. But that's just adding on another special case, so it might be simpler to allow arbitrary expressions.
- Previous message: [Python-Dev] Decorator syntax
- Next message: [Python-Dev] Decorator syntax
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]