Skip to content

Commit 9516cd4

Browse files
committed
Correct inaccuracies in syntax documentation
1 parent d0e7c6a commit 9516cd4

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Doc/reference/expressions.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ Parenthesized forms
321321
A parenthesized form is an optional expression list enclosed in parentheses:
322322

323323
.. productionlist:: python-grammar
324-
parenth_form: "(" [`starred_expression`] ")"
324+
parenth_form: "(" [`flexible_expression_list`] ")"
325325

326326
A parenthesized expression list yields whatever that expression list yields: if
327327
the list contains at least one comma, it yields a tuple; otherwise, it yields
@@ -628,7 +628,7 @@ Yield expressions
628628
.. productionlist:: python-grammar
629629
yield_atom: "(" `yield_expression` ")"
630630
yield_from: "yield" "from" `expression`
631-
yield_expression: "yield" `yield_list` | `yield_from`
631+
yield_expression: "yield" [`yield_list` | `yield_from`]
632632

633633
The yield expression is used when defining a :term:`generator` function
634634
or an :term:`asynchronous generator` function and

Doc/reference/simple_stmts.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ expression statements are allowed and occasionally useful. The syntax for an
4848
expression statement is:
4949

5050
.. productionlist:: python-grammar
51-
expression_stmt: `starred_expression`
51+
expression_stmt: `starred_expression_list`
5252

5353
An expression statement evaluates the expression list (which may be a single
5454
expression).
@@ -84,7 +84,7 @@ Assignment statements are used to (re)bind names to values and to modify
8484
attributes or items of mutable objects:
8585

8686
.. productionlist:: python-grammar
87-
assignment_stmt: (`target_list` "=")+ (`starred_expression` | `yield_expression`)
87+
assignment_stmt: (`target_list` "=")+ (`starred_expression_list` | `yield_expression`)
8888
target_list: `target` ("," `target`)* [","]
8989
target: `identifier`
9090
: | "(" [`target_list`] ")"
@@ -275,7 +275,7 @@ Augmented assignment is the combination, in a single statement, of a binary
275275
operation and an assignment statement:
276276

277277
.. productionlist:: python-grammar
278-
augmented_assignment_stmt: `augtarget` `augop` (`expression_list` | `yield_expression`)
278+
augmented_assignment_stmt: `augtarget` `augop` (`starred_expression_list` | `yield_expression`)
279279
augtarget: `identifier` | `attributeref` | `subscription`
280280
augop: "+=" | "-=" | "*=" | "@=" | "/=" | "//=" | "%=" | "**="
281281
: | ">>=" | "<<=" | "&=" | "^=" | "|="
@@ -324,7 +324,7 @@ statement, of a variable or attribute annotation and an optional assignment stat
324324

325325
.. productionlist:: python-grammar
326326
annotated_assignment_stmt: `augtarget` ":" `expression`
327-
: ["=" (`starred_expression` | `yield_expression`)]
327+
: ["=" (`starred_expression_list` | `yield_expression`)]
328328

329329
The difference from normal :ref:`assignment` is that only a single target is allowed.
330330

0 commit comments

Comments
 (0)