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: Language Reference - Function definition parameter_list item definition not equivalent to implementation.
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.8
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Michael S2, docs@python, pablogsal
Priority: normal Keywords:

Created on 2020-03-17 13:08 by Michael S2, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg364425 - (view) Author: Michael S (Michael S2) Date: 2020-03-17 13:08
I just read
 https://docs.python.org/3/reference/compound_stmts.html#function-definitions

The item parameter_list is defined as: 

parameter_list            ::=  defparameter ("," defparameter)* "," "/" ["," [parameter_list_no_posonly]] | parameter_list_no_posonly

This definition states that the "," "/" after ("," defparameter)* are mandatory. But this is not true in Python 3.8, because you can define a function as 

def f(a):
    pass

Did I miss something?
msg364430 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-03-17 14:13
> Did I miss something?

Yep, what you are missing is that the rule is really:

(defparameter ("," defparameter)* "," "/" ["," [parameter_list_no_posonly]]) | (parameter_list_no_posonly)

which means that is either 

defparameter ("," defparameter)* "," "/" ["," [parameter_list_no_posonly]]

or

parameter_list_no_posonly

and for the def(a): pass case the corresponding rule is parameter_list_no_posonly (check the rest of the specification).

Do you think that adding these explicit parentheses would help with help making this more clear?
msg364433 - (view) Author: Michael S (Michael S2) Date: 2020-03-17 14:57
Thanks Pablo, 

sorry, I was just stupid.

> Do you think that adding these explicit parentheses would help with help making this more clear?

Maybe. I read the BNF documentation the first time today, but since it's not intended for beginners, I think it's clear enough.

How should we continue with this issue? I don't really see any closing button or the like.
History
Date User Action Args
2022-04-11 14:59:28adminsetgithub: 84174
2020-03-17 14:59:41serhiy.storchakasetstatus: open -> closed
resolution: not a bug
stage: resolved
2020-03-17 14:57:09Michael S2setmessages: + msg364433
2020-03-17 14:13:55pablogsalsetnosy: + pablogsal
messages: + msg364430
2020-03-17 13:08:22Michael S2create