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.

classification
Title: Incorrect grammar for function definitions
Type: Stage: resolved
Components: Documentation Versions: Python 3.6, Python 3.2, Python 3.3, Python 3.4, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Eric.Wieser, benjamin.peterson, docs@python, python-dev
Priority: normal Keywords:

Created on 2016-05-16 22:12 by Eric.Wieser, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (4)
msg265735 - (view) Author: Eric Wieser (Eric.Wieser) * Date: 2016-05-16 22:12
https://docs.python.org/3.2/reference/compound_stmts.html#function-definitions 

and onwards say the following

    decorator      ::=  "@" dotted_name ["(" [parameter_list [","]] ")"] NEWLINE

This is a regression from the 2.7 docs, which correctly said

    decorator      ::=  "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE

The implication is that the following is supposedly valid in python 3:

    @deco(what : "is this" = "supposed to mean")
    def foo(annotations: "are only for here" = "right?"):
        pass

The interpreter disagrees with the docs, and correctly rejects this syntax as garbage
msg265752 - (view) Author: Eric Wieser (Eric.Wieser) * Date: 2016-05-17 03:18
The offending patch can be found at https://hg.python.org/cpython/rev/71ff2235bb4c
msg265755 - (view) Author: Eric Wieser (Eric.Wieser) * Date: 2016-05-17 03:46
The parent commit is also bad:

https://hg.python.org/cpython/rev/b65007ef59c0
msg265758 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-05-17 06:20
New changeset 451dd29ebae3 by Benjamin Peterson in branch '3.5':
Backed out changeset 71ff2235bb4c (closes #27042)
https://hg.python.org/cpython/rev/451dd29ebae3

New changeset d13999a6be8c by Benjamin Peterson in branch '3.5':
class definitions only get argument lists (closes #27042)
https://hg.python.org/cpython/rev/d13999a6be8c

New changeset d384bf58f5f8 by Benjamin Peterson in branch 'default':
merge 3.5 (#27042)
https://hg.python.org/cpython/rev/d384bf58f5f8
History
Date User Action Args
2022-04-11 14:58:31adminsetgithub: 71229
2016-05-17 06:20:48python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg265758

resolution: fixed
stage: resolved
2016-05-17 05:58:03orsenthilsetnosy: + benjamin.peterson
2016-05-17 03:46:01Eric.Wiesersetmessages: + msg265755
2016-05-17 03:18:37Eric.Wiesersetmessages: + msg265752
2016-05-16 22:12:05Eric.Wiesercreate