2011/10/19 Nick Coghlan <ncoghlan@gmail.com>:
2011/10/20 Guido van Rossum <guido@python.org>:
If this gets changed we won't be able to give a different meaning to e.g.
@(...) @[...] @{...}
since those will all have to be accepted as valid forms of the syntax
@<expr>
True, although the restriction could just be weakened to "must start with an identifier" rather than eliminated entirely. Since tuples, lists, dictionaries and sets aren't callable, that wouldn't be a noticeable restriction in practice.
But surely someone would manage to come up with a use case for an expression *starting* with one of those, e.g. @[f, g, h][i] or @{a: b, c: d}[x] I don't think it's reasonable to constrain it less than it currently is but more than a general expression. Though I wouldn't allow commas -- there's no way that @f, g def pooh(): ... can make sense. Oh way, it could be a shorthand for @f @g def pooh(): ... :-) -- --Guido van Rossum (python.org/~guido)