[New-bugs-announce] [issue27042] Incorrect grammar for function definitions

Eric Wieser report at bugs.python.org
Mon May 16 18:12:05 EDT 2016

New submission from Eric Wieser:


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?"):

The interpreter disagrees with the docs, and correctly rejects this syntax as garbage

assignee: docs at python
components: Documentation
messages: 265735
nosy: Eric.Wieser, docs at 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 at bugs.python.org>

More information about the New-bugs-announce mailing list