[issue19660] decorator syntax: allow testlist instead of just dotted_name

Nick Coghlan report at bugs.python.org
Thu Nov 21 04:32:27 CET 2013


Nick Coghlan added the comment:

Yes, a PEP for 3.5 on this will be valuable, whether it's accepted or not
(although I personally favour moving these restrictions out of the compiler
and into the PEP 8 style guide).

If I recall the past python-ideas threads correctly, the main objections to
the current syntax restrictions were:

- you can't look up decorators through a registry by default, since
"@registry[name]" is disallowed
- it's not really a limitation anyway, since a pass through function still
lets you write whatever you want:

    def deco(x): return x

    @deco(registry[name])
    def f(): ...

Now that the precedent of keeping decorator expressions simple has been
well and truly established, simplification of the grammar is the main
reason removing the special casing of decorator syntax from the compilation
toolchain appeals to me.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19660>
_______________________________________


More information about the Python-bugs-list mailing list