bpo-33702: Add some missing links in production lists and do a little polish#7259
Conversation
Doc/reference/compound_stmts.rst
Outdated
| parameter_list_starargs: "*" [`parameter`] ("," `defparameter`)* ["," ["**" `parameter` [","]]] | ||
| : | "**" `parameter` [","] | ||
| parameter_list: `defparameter` ("," `defparameter`)* | ||
| : ["," [`parameter_list_starargs`]] | `parameter_list_starargs` |
There was a problem hiding this comment.
I think it is better to left this and the following production lists as is.
Doc/reference/expressions.rst
Outdated
| slice_list: `slice_item` ("," `slice_item`)* [","] | ||
| slice_item: `expression` | `proper_slice` | ||
| proper_slice: [`lower_bound`] ":" [`upper_bound`] [ ":" [`stride`] ] | ||
| proper_slice: [`lower_bound`] ":" [`upper_bound`] [":" [`stride`]] |
There was a problem hiding this comment.
I think a space between ]'s increase readability. And the space after [ was added for symmetry.
Doc/reference/expressions.rst
Outdated
| call: `primary` "(" [`argument_list` [","] | `comprehension`] ")" | ||
| argument_list: `positional_arguments` ["," `starred_and_keywords`] | ||
| : ["," `keywords_arguments`] | ||
| : ["," `keywords_arguments`] |
There was a problem hiding this comment.
Left it as is. Extra spaces help to see a difference between the continuation and the alternation.
Doc/reference/lexical_analysis.rst
Outdated
| replacement_field: "{" `f_expression` ["!" `conversion`] [":" `format_spec`] "}" | ||
| f_expression: (`conditional_expression` | "*" `or_expr`) | ||
| : ("," `conditional_expression` | "," "*" `or_expr`)* [","] | ||
| : ("," `conditional_expression` | "," "*" `or_expr`)* [","] |
| : ( "," `identifier` ["as" `name`] )* | ||
| : | "from" `relative_module` "import" "(" `identifier` ["as" `name`] | ||
| : ( "," `identifier` ["as" `name`] )* [","] ")" | ||
| import_stmt: "import" `module` ["as" `identifier`] ("," `module` ["as" `identifier`])* |
There was a problem hiding this comment.
Why name was replaced by identifier?
There was a problem hiding this comment.
Because, when I added a link to name in future statements, it linked to the name in import statements. That's why I replaced name in both places to "identifier". Perhaps it can be solved in other way?
There was a problem hiding this comment.
Ah, I see, the problem was that name was defined in two places. Then using an identifier LGTM. In the Grammar file the same term is used for the names before and after 'as' in import_from.
Doc/reference/compound_stmts.rst
Outdated
| : | `parameter_list_starargs` | ||
| parameter_list_starargs: "*" [`parameter`] ("," `defparameter`)* ["," ["**" `parameter` [","]]] | ||
| : | "**" `parameter` [","] | ||
| parameter_list_starargs: "*" [`parameter`] ("," `defparameter`)* |
There was a problem hiding this comment.
It is better to break a line before | than at arbitrary place. I think it is better to keep the existing formatting. It is not much longer that the previous production list.
| : ( "," `identifier` ["as" `name`] )* | ||
| : | "from" `relative_module` "import" "(" `identifier` ["as" `name`] | ||
| : ( "," `identifier` ["as" `name`] )* [","] ")" | ||
| import_stmt: "import" `module` ["as" `identifier`] ("," `module` ["as" `identifier`])* |
There was a problem hiding this comment.
Ah, I see, the problem was that name was defined in two places. Then using an identifier LGTM. In the Grammar file the same term is used for the names before and after 'as' in import_from.
|
Thanks @andresdelfino for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7. |
… polish (pythonGH-7259) (cherry picked from commit caccca7) Co-authored-by: Andrés Delfino <adelfino@gmail.com>
|
GH-8169 is a backport of this pull request to the 3.7 branch. |
… polish (pythonGH-7259) (cherry picked from commit caccca7) Co-authored-by: Andrés Delfino <adelfino@gmail.com>
|
GH-8170 is a backport of this pull request to the 3.6 branch. |
https://bugs.python.org/issue33702