Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'main' into fix-issue-46033-for-statement-docs
  • Loading branch information
terryjreedy authored Apr 2, 2022
commit a83fbcb46b51e20e44d39d67c48467ee4f61d5cb
8 changes: 5 additions & 3 deletions Doc/reference/compound_stmts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,11 @@ The :keyword:`for` statement is used to iterate over the elements of a sequence
for_stmt: "for" `target_list` "in" `starred_list` ":" `suite`
: ["else" ":" `suite`]

The expression list is evaluated once; it should yield an iterable object. An
iterator is created for the result of the ``expression_list``. First item
provided by the iterator is then assigned to the target list using the standard
The starred list expression is evaluated once; it should yield an iterable object.
If the expression is a sequence, it can contain starred elements (``*x, *y``)
that will be unpacked, as when constructing a ``tuple`` or ``list`` literal.
An iterator is created for the resulting iterable. The first item provided
by the iterator is then assigned to the target list using the standard
rules for assignments (see :ref:`assignment`), and the suite is executed - this
repeats for each item provided by the iterator. When the items are exhausted
(which is immediately when the sequence is empty or an iterator raises
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.