Issue 32024: Nominal decorator function call syntax is inconsistent with regular function calls (original) (raw)

Issue32024

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/76205

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 2022-04-11 14:58 by admin.

Messages (3)
msg306205 - (view) Author: Alyssa 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
2022-04-11 14:58:54 admin set github: 76205
2017-11-15 08:57:43 serhiy.storchaka set messages: +
2017-11-14 18:25:26 serhiy.storchaka set dependencies: + Disallow ambiguous syntax f(x for x in [1],)type: behavior -> enhancementversions: + Python 3.7
2017-11-14 18:00:57 gvanrossum set messages: +
2017-11-14 13:09:52 ncoghlan create