Skip to content

Commit 3795065

Browse files
committed
star_expressions
1 parent 6873af5 commit 3795065

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Doc/reference/compound_stmts.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,18 @@ The :keyword:`for` statement is used to iterate over the elements of a sequence
154154
(such as a string, tuple, or list) or other iterable object:
155155

156156
.. productionlist:: python-grammar
157-
for_stmt: "for" `target_list` "in" `expression_list` ":" `suite`
157+
for_stmt: "for" `target_list` "in" `star_expressions` ":" `suite`
158158
: ["else" ":" `suite`]
159159

160-
The ``expression_list`` is evaluated once; it should yield an :term:`iterable` object.
160+
The expression following ``in`` is evaluated once; it should yield an :term:`iterable` object.
161161
An :term:`iterator` is created for that iterable. The first item provided by the iterator
162162
is then assigned to the target list using the standard rules for assignments
163163
(see :ref:`assignment`), and the suite is executed. This repeats for each item provided
164164
by the iterator. When the iterator is exhausted, the suite in the :keyword:`!else` clause,
165165
if present, is executed, and the loop terminates.
166166

167-
Note that as of Python 3.11, unpacking with starred expressions (e.g., ``*x``) is supported
168-
in the iterable expression list.
167+
As of Python 3.11, unpacking with starred expressions (e.g., ``*x``) is supported
168+
in the iterable expression. This follows the same rules as :token:`star_expressions` in the grammar.
169169

170170
.. index::
171171
pair: statement; break

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy