[issue27042] Incorrect grammar for function definitions
New submission from Eric Wieser: https://docs.python.org/3.2/reference/compound_stmts.html#function-definitio... 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 ---------- assignee: docs@python components: Documentation messages: 265735 nosy: Eric.Wieser, docs@python priority: normal severity: normal status: open title: Incorrect grammar for function definitions versions: Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27042> _______________________________________
Eric Wieser added the comment: The offending patch can be found at https://hg.python.org/cpython/rev/71ff2235bb4c ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27042> _______________________________________
Eric Wieser added the comment: The parent commit is also bad: https://hg.python.org/cpython/rev/b65007ef59c0 ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27042> _______________________________________
Changes by Senthil Kumaran <senthil@uthcode.com>: ---------- nosy: +benjamin.peterson _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27042> _______________________________________
Roundup Robot added the comment: 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 ---------- nosy: +python-dev resolution: -> fixed stage: -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27042> _______________________________________
participants (3)
-
Eric Wieser -
Roundup Robot -
Senthil Kumaran