[issue32024] Nominal decorator function call syntax is inconsistent with regular function calls
New submission from Nick Coghlan <ncoghlan@gmail.com>: Function calls in decorators are implemented as regular function calls, and hence permit the use of generator expressions as their sole argument without a second pair of parentheses. However, https://docs.python.org/3/reference/compound_stmts.html#function-definitions defines the permitted arguments differently from the way https://docs.python.org/3/reference/expressions.html#calls defines them, and thus technically considers a "function call as a decorator" to be a different construct from "a function call". The actual implementation treats these as the same thing, so clarification is needed as to whether it is the implementation or the language specification that should be updated to resolve the inconsistency. ---------- assignee: docs@python components: Documentation messages: 306205 nosy: docs@python, gvanrossum, ncoghlan, serhiy.storchaka priority: normal severity: normal stage: needs patch status: open title: Nominal decorator function call syntax is inconsistent with regular function calls type: behavior _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue32024> _______________________________________
Guido van Rossum <guido@python.org> added the comment: The implementation is as intended and the language spec needs an update. ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue32024> _______________________________________
Change by Serhiy Storchaka <storchaka+cpython@gmail.com>: ---------- dependencies: +Disallow ambiguous syntax f(x for x in [1],) type: behavior -> enhancement versions: +Python 3.7 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue32024> _______________________________________
Serhiy Storchaka <storchaka+cpython@gmail.com> added the comment: Since this change is approved, this is a documentation issue, and I left it on to Nick. ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue32024> _______________________________________
participants (3)
-
Guido van Rossum
-
Nick Coghlan
-
Serhiy Storchaka