mirror of
https://github.com/python/cpython.git
synced 2025-12-15 21:44:50 +00:00
clarify discussion of iteration in the section on the "for" statement
(SF bug #829073)
This commit is contained in:
parent
303e30ef9f
commit
7fabaf8375
1 changed files with 4 additions and 2 deletions
|
|
@ -134,8 +134,10 @@ sequence (such as a string, tuple or list) or other iterable object:
|
|||
\productioncont{["else" ":" \token{suite}]}
|
||||
\end{productionlist}
|
||||
|
||||
The expression list is evaluated once; it should yield a sequence. The
|
||||
suite is then executed once for each item in the sequence, in the
|
||||
The expression list is evaluated once; it should yield an iterable
|
||||
object. An iterator is created for the result of the
|
||||
{}\code{expression_list}. The suite is then executed once for each
|
||||
item provided by the iterator, in the
|
||||
order of ascending indices. Each item in turn is assigned to the
|
||||
target list using the standard rules for assignments, and then the
|
||||
suite is executed. When the items are exhausted (which is immediately
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue