@@ -253,7 +253,7 @@ A list display is a possibly empty series of expressions enclosed in square
253
253
brackets:
254
254
255
255
.. productionlist :: python-grammar
256
- list_display: "[" [`starred_list ` | `comprehension `] "]"
256
+ list_display: "[" [`expression_list ` | `comprehension `] "]"
257
257
258
258
A list display yields a new list object, the contents being specified by either
259
259
a list of expressions or a comprehension. When a comma-separated list of
@@ -278,7 +278,7 @@ A set display is denoted by curly braces and distinguishable from dictionary
278
278
displays by the lack of colons separating keys and values:
279
279
280
280
.. productionlist :: python-grammar
281
- set_display: "{" (`starred_list ` | `comprehension `) "}"
281
+ set_display: "{" (`expression_list ` | `comprehension `) "}"
282
282
283
283
A set display yields a new mutable set object, the contents being specified by
284
284
either a sequence of expressions or a comprehension. When a comma-separated
@@ -455,8 +455,8 @@ generator. That generator then controls the execution of the generator
455
455
function. The execution starts when one of the generator's methods is called.
456
456
At that time, the execution proceeds to the first yield expression, where it is
457
457
suspended again, returning the value of
458
- :token: `~python-grammar:flexible_expression_list ` to the generator's caller,
459
- or ``None `` if :token: `~python-grammar:flexible_expression_list ` is omitted.
458
+ :token: `~python-grammar:expression_list ` to the generator's caller,
459
+ or ``None `` if :token: `~python-grammar:expression_list ` is omitted.
460
460
By suspended, we mean that all local state is
461
461
retained, including the current bindings of local variables, the instruction
462
462
pointer, the internal evaluation stack, and the state of any exception handling.
@@ -545,7 +545,7 @@ is already executing raises a :exc:`ValueError` exception.
545
545
:meth: `~generator.__next__ ` method, the current yield expression always
546
546
evaluates to :const: `None `. The execution then continues to the next yield
547
547
expression, where the generator is suspended again, and the value of the
548
- :token: `~python-grammar:flexible_expression_list ` is returned to
548
+ :token: `~python-grammar:expression_list ` is returned to
549
549
:meth: `__next__ `'s caller. If the generator exits without yielding another
550
550
value, a :exc: `StopIteration ` exception is raised.
551
551
@@ -664,7 +664,7 @@ how a generator object would be used in a :keyword:`for` statement.
664
664
Calling one of the asynchronous generator's methods returns an :term: `awaitable `
665
665
object, and the execution starts when this object is awaited on. At that time,
666
666
the execution proceeds to the first yield expression, where it is suspended
667
- again, returning the value of :token: `~python-grammar:flexible_expression_list `
667
+ again, returning the value of :token: `~python-grammar:expression_list `
668
668
to the awaiting coroutine. As with a generator, suspension means that all local
669
669
state is retained, including the current bindings of local variables, the
670
670
instruction pointer, the internal evaluation stack, and the state of any
@@ -728,7 +728,7 @@ which are used to control the execution of a generator function.
728
728
asynchronous generator function is resumed with an :meth: `~agen.__anext__ `
729
729
method, the current yield expression always evaluates to :const: `None ` in the
730
730
returned awaitable, which when run will continue to the next yield
731
- expression. The value of the :token: `~python-grammar:flexible_expression_list `
731
+ expression. The value of the :token: `~python-grammar:expression_list `
732
732
of the yield expression is the value of the :exc: `StopIteration ` exception
733
733
raised by the completing coroutine. If the asynchronous generator exits
734
734
without yielding another value, the awaitable instead raises a
@@ -861,7 +861,7 @@ will generally select an element from the container. The subscription of a
861
861
:ref: `GenericAlias <types-genericalias >` object.
862
862
863
863
.. productionlist :: python-grammar
864
- subscription: `primary ` "[" `flexible_expression_list ` "]"
864
+ subscription: `primary ` "[" `expression_list ` "]"
865
865
866
866
When an object is subscripted, the interpreter will evaluate the primary and
867
867
the expression list.
@@ -1879,11 +1879,11 @@ Expression lists
1879
1879
1880
1880
.. productionlist :: python-grammar
1881
1881
1882
- starred_item: "* " `or_expr `
1883
- flexible_expression : `expression ` | ` assignment_expression ` | ` starred_item `
1884
- flexible_expression_list: ` flexible_expression ` ( "," ` flexible_expression `)* ["," ]
1885
- yield_list : `expression ` ["," ` flexible_expression_list `]
1886
- | `starred_item` "," [`flexible_expression_list`]
1882
+ expression_list: ` flexible_expression ` (", " `flexible_expression `)* [","]
1883
+ yield_list : `expression ` ["," ` expression_list `]
1884
+ | `starred_expression` "," [`expression_list` ]
1885
+ flexible_expression : `assignment_expression ` | ` starred_expression `
1886
+ starred_expression: "*" ` or_expr `
1887
1887
1888
1888
.. index :: pair: object; tuple
1889
1889
0 commit comments