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) *  |
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) *  |
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) *  |
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 [","] |