classification
Title: Nominal decorator function call syntax is inconsistent with regular function calls
Type: enhancement Stage: needs patch
Components: Documentation Versions: Python 3.7
process
Status: open Resolution:
Dependencies: 32012 Superseder:
Assigned To: docs@python Nosy List: docs@python, gvanrossum, ncoghlan, serhiy.storchaka
Priority: normal Keywords:

Created on 2017-11-14 13:09 by ncoghlan, last changed 2017-11-15 08:57 by serhiy.storchaka.

Messages (3)
msg306205 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2017-11-14 13:09
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.
msg306234 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2017-11-14 18:00
The implementation is as intended and the language spec needs an update.
msg306258 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-11-15 08:57
Since this change is approved, this is a documentation issue, and I left it on to Nick.
History
Date User Action Args
2017-11-15 08:57:43serhiy.storchakasetmessages: + msg306258
2017-11-14 18:25:26serhiy.storchakasetdependencies: + Disallow ambiguous syntax f(x for x in [1],)
type: behavior -> enhancement
versions: + Python 3.7
2017-11-14 18:00:57gvanrossumsetmessages: + msg306234
2017-11-14 13:09:52ncoghlancreate