Skip to content

Commit b8beb7d

Browse files
committed
star_expressions
1 parent 9967ec9 commit b8beb7d

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

Doc/reference/compound_stmts.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,14 @@ The :keyword:`for` statement is used to iterate over the elements of a sequence
157157
for_stmt: "for" `target_list` "in" `starred_expression_list` ":" `suite`
158158
: ["else" ":" `suite`]
159159

160-
The expression following ``in`` is evaluated once; it should yield an :term:`iterable` object.
161-
An :term:`iterator` is created for that iterable. The first item provided by the iterator
162-
is then assigned to the target list using the standard rules for assignments
163-
(see :ref:`assignment`), and the suite is executed. This repeats for each item provided
164-
by the iterator. When the iterator is exhausted, the suite in the :keyword:`!else` clause,
165-
if present, is executed, and the loop terminates.
166-
167-
As of Python 3.11, unpacking with starred expressions (e.g., ``*x``) is supported
168-
in the iterable expression.
160+
The expression following ``in`` is evaluated once; it should yield an
161+
:term:`iterable` object. An :term:`iterator` is created for that iterable. The
162+
first item provided by the iterator is then assigned to the target list using
163+
the standard rules for assignments (see :ref:`assignment`), and the suite is
164+
executed. This repeats for each item provided by the iterator. When the iterator
165+
is exhausted, the suite in the :keyword:`!else` clause, if present, is
166+
executed,
167+
and the loop terminates.
169168

170169
.. index::
171170
pair: statement; break
@@ -197,7 +196,7 @@ the built-in type :func:`range` represents immutable arithmetic sequences of int
197196
For instance, iterating ``range(3)`` successively yields 0, 1, and then 2.
198197

199198
.. versionchanged:: 3.11
200-
Starred elements are now allowed in the expression list.
199+
starred elements are now allowed in the expression list.
201200

202201

203202
.. _try:
@@ -234,7 +233,8 @@ and information on using the :keyword:`raise` statement to generate exceptions
234233
may be found in section :ref:`raise`.
235234

236235
.. versionchanged:: 3.14
237-
Support for optionally dropping grouping parentheses when using multiple exception types. See :pep:`758`.
236+
Support for optionally dropping grouping parentheses when using multiple
237+
exception types. See :pep:`758`.
238238

239239
.. _except:
240240

Doc/reference/expressions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1928,7 +1928,7 @@ Expression lists
19281928
single: , (comma); expression list
19291929

19301930
.. productionlist:: python-grammar
1931-
starred_expression: ["*"] `or_expr`
1931+
starred_expression: "*" `or_expr` | `expression`
19321932
flexible_expression: `assignment_expression` | `starred_expression`
19331933
flexible_expression_list: `flexible_expression` ("," `flexible_expression`)* [","]
19341934
starred_expression_list: `starred_expression` ("," `starred_expression`)* [","]

0 commit comments

Comments
 (0)