@@ -157,17 +157,14 @@ The :keyword:`for` statement is used to iterate over the elements of a sequence
157
157
for_stmt: "for" `target_list ` "in" `starred_list ` ":" `suite `
158
158
: ["else" ":" `suite `]
159
159
160
- The expression list is evaluated once; it should yield an iterable object. An
161
- iterator is created for the result of the ``starred_list ``. The expression
162
- list can contain starred elements (``*x, *y ``) that will be unpacked in the
163
- final iterator (as when constructing a ``tuple `` or ``list `` literal). The
164
- suite is then executed once for each item provided by the iterator, in the
165
- order returned by the iterator. Each item in turn is assigned to the target
166
- list using the standard rules for assignments (see :ref: `assignment `), and then
167
- the suite is executed. When the items are exhausted (which is immediately when
168
- the sequence is empty or an iterator raises a :exc: `StopIteration ` exception),
169
- the suite in the :keyword: `!else ` clause, if present, is executed, and the loop
170
- terminates.
160
+ The ``starred_list `` expression is evaluated once; it should yield an
161
+ :term: `iterable ` object. An :term: `iterator ` is created for that iterable.
162
+ The first item provided
163
+ by the iterator is then assigned to the target list using the standard
164
+ rules for assignments (see :ref: `assignment `), and the suite is executed. This
165
+ repeats for each item provided by the iterator. When the iterator is exhausted,
166
+ the suite in the :keyword: `!else ` clause,
167
+ if present, is executed, and the loop terminates.
171
168
172
169
.. index ::
173
170
statement: break
0 commit comments