classification
Title: a redundant right parentheses in the EBNF rules of parameter_list
Type: Stage: needs patch
Components: Documentation Versions: Python 3.7, Python 3.6, Python 3.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Jim Fasarakis-Hilliard, docs@python, r.david.murray, woo yoo
Priority: normal Keywords: patch

Created on 2016-12-15 11:59 by woo yoo, last changed 2016-12-29 12:42 by Jim Fasarakis-Hilliard.

Files
File name Uploaded Description Edit
3.3_func_def.patch Jim Fasarakis-Hilliard, 2016-12-29 12:41 review
3.4_3.5_func_def.patch Jim Fasarakis-Hilliard, 2016-12-29 12:41 review
3.6_3.7_func_def.patch Jim Fasarakis-Hilliard, 2016-12-29 12:42 review
Messages (13)
msg283288 - (view) Author: woo yoo (woo yoo) Date: 2016-12-15 11:59
Quote the documentation as below:

> parameter_list ::=  (defparameter ",")*
                    | "*" [parameter] ("," defparameter)* ["," "**" parameter]
                    | "**" parameter
                    | defparameter [","] )

The last right parenthesis is redundant.And the second alternative form is not complete, it does not incorporate a case that only include starred parameter.
msg283289 - (view) Author: woo yoo (woo yoo) Date: 2016-12-15 12:00
Here is the link https://docs.python.org/3/reference/compound_stmts.html#function-definitions
msg283291 - (view) Author: woo yoo (woo yoo) Date: 2016-12-15 12:04
Just the right parenthesis is redundant, ignore other words.
msg283295 - (view) Author: woo yoo (woo yoo) Date: 2016-12-15 12:52
And i find that the current rules of parameter_list includes a bare '*',which is illegal in practice.
msg283296 - (view) Author: Jim Fasarakis-Hilliard (Jim Fasarakis-Hilliard) * Date: 2016-12-15 13:07
See issue<9232> that changed the docs on function definitions. These changes aren't reflected in the 3.5 documentation though, you'll find them in the 3.6 docs.

The linked grammar is probably missing an opening parentheses from what I can tell, i.e change | to (:

    ( "*" [parameter] ("," defparameter)* ["," "**" parameter]
msg283299 - (view) Author: woo yoo (woo yoo) Date: 2016-12-15 13:40
There is  a few difference between Python-3.5.2 and Python-3.6.2 concerning the EBNF rules even though the parenthesis bug is fixed.
msg283301 - (view) Author: woo yoo (woo yoo) Date: 2016-12-15 13:43
Nor the rules in Python-3.6.0 excludes the bare '*' following no parameters.
msg283314 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2016-12-15 14:51
What do you mean by "a bare * followed by no parameters"?  That is, what is the thing that is considered invalid that you are saying the BNF rules allow?  I'm looking for a code snipped that produces a syntax error.
msg283316 - (view) Author: woo yoo (woo yoo) Date: 2016-12-15 14:59
Code:
>>>def f(a, *):
>>>    print(a)
....
....(SyntaxError occurs here)
msg283318 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2016-12-15 15:03
Ah, I see.  (", " defparameter)* should instead be "+", or whatever the BNF equivalent is.
msg284253 - (view) Author: Jim Fasarakis-Hilliard (Jim Fasarakis-Hilliard) * Date: 2016-12-29 12:41
Attached patche for Python 3.3 (change `defparameter` to use `+`).
msg284254 - (view) Author: Jim Fasarakis-Hilliard (Jim Fasarakis-Hilliard) * Date: 2016-12-29 12:41
Further patch for `3.4` and `3.5`:

Change `|` to `(` and fix `defparameter` to use `+`
msg284255 - (view) Author: Jim Fasarakis-Hilliard (Jim Fasarakis-Hilliard) * Date: 2016-12-29 12:42
Further patch for 3.6 and 3.7 to address `defparameter` change here too.
History
Date User Action Args
2016-12-29 12:42:44Jim Fasarakis-Hilliardsetfiles: + 3.6_3.7_func_def.patch

messages: + msg284255
2016-12-29 12:41:48Jim Fasarakis-Hilliardsetfiles: + 3.4_3.5_func_def.patch

messages: + msg284254
2016-12-29 12:41:01Jim Fasarakis-Hilliardsetfiles: + 3.3_func_def.patch
keywords: + patch
messages: + msg284253
2016-12-24 10:09:27martin.panterlinkissue22942 dependencies
2016-12-24 10:06:38martin.pantersetstage: needs patch
versions: + Python 3.6, Python 3.7
2016-12-15 15:03:47r.david.murraysetmessages: + msg283318
2016-12-15 14:59:32woo yoosetmessages: + msg283316
2016-12-15 14:51:50r.david.murraysetnosy: + r.david.murray
messages: + msg283314
2016-12-15 13:43:12woo yoosetmessages: + msg283301
2016-12-15 13:40:20woo yoosetmessages: + msg283299
2016-12-15 13:07:08Jim Fasarakis-Hilliardsetnosy: + Jim Fasarakis-Hilliard
messages: + msg283296
2016-12-15 12:52:25woo yoosetmessages: + msg283295
2016-12-15 12:04:20woo yoosetmessages: + msg283291
2016-12-15 12:00:22woo yoosetmessages: + msg283289
2016-12-15 11:59:34woo yoocreate