Skip to content

Typo in BNF description of function signatures #131457

@brendan-m-murphy

Description

@brendan-m-murphy

Documentation

The definition of parameter_list_starargs is missing a |:

parameter_list_starargs   ::= "*" [star_parameter] ("," defparameter)* ["," [parameter_star_kwargs]]
                              "*" ("," defparameter)+ ["," [parameter_star_kwargs]]
                              | parameter_star_kwargs

should be

parameter_list_starargs   ::= "*" [star_parameter] ("," defparameter)* ["," [parameter_star_kwargs]]
                              | "*" ("," defparameter)+ ["," [parameter_star_kwargs]]
                              | parameter_star_kwargs

Without that |, the definition says that you can have two * symbols in a signature. With the |, the second line describes "keyword only" arguments.

Link to current docs:
https://docs.python.org/3/reference/compound_stmts.html#function-definitions

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions