Issue 28978: a redundant right parentheses in the EBNF rules of parameter_list (original) (raw)

Created on 2016-12-15 11:59 by woo yoo, last changed 2022-04-11 14:58 by admin. This issue is now closed.

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 (14)
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.
msg401160 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-09-06 17:02
This doc has changed, and it's now like this: parameter_list ::= defparameter ("," defparameter)* "," "/" ["," [parameter_list_no_posonly]] | parameter_list_no_posonly parameter_list_no_posonly ::= defparameter ("," defparameter)* ["," [parameter_list_starargs]] parameter_list_starargs parameter_list_starargs ::= "*" [parameter] ("," defparameter)* ["," ["**" parameter [","]]] "**" parameter [","]
History
Date User Action Args
2022-04-11 14:58:40 admin set github: 73164
2021-09-06 17:02:24 iritkatriel set status: open -> closednosy: + iritkatrielmessages: + resolution: out of datestage: needs patch -> resolved
2016-12-29 12:42:44 Jim Fasarakis-Hilliard set files: + 3.6_3.7_func_def.patchmessages: +
2016-12-29 12:41:48 Jim Fasarakis-Hilliard set files: + 3.4_3.5_func_def.patchmessages: +
2016-12-29 12:41:01 Jim Fasarakis-Hilliard set files: + 3.3_func_def.patchkeywords: + patchmessages: +
2016-12-24 10:09:27 martin.panter link issue22942 dependencies
2016-12-24 10:06:38 martin.panter set stage: needs patchversions: + Python 3.6, Python 3.7
2016-12-15 15:03:47 r.david.murray set messages: +
2016-12-15 14:59:32 woo yoo set messages: +
2016-12-15 14:51:50 r.david.murray set nosy: + r.david.murraymessages: +
2016-12-15 13:43:12 woo yoo set messages: +
2016-12-15 13:40:20 woo yoo set messages: +
2016-12-15 13:07:08 Jim Fasarakis-Hilliard set nosy: + Jim Fasarakis-Hilliardmessages: +
2016-12-15 12:52:25 woo yoo set messages: +
2016-12-15 12:04:20 woo yoo set messages: +
2016-12-15 12:00:22 woo yoo set messages: +
2016-12-15 11:59:34 woo yoo create