Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[3.14] gh-134026: Fix grammar description of for statement (GH-134034) #134424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 7 additions & 7 deletions 14 Doc/reference/compound_stmts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,15 @@ The :keyword:`for` statement is used to iterate over the elements of a sequence
(such as a string, tuple or list) or other iterable object:

.. productionlist:: python-grammar
for_stmt: "for" `target_list` "in" `starred_list` ":" `suite`
for_stmt: "for" `target_list` "in" `starred_expression_list` ":" `suite`
: ["else" ":" `suite`]

The ``starred_list`` expression is evaluated once; it should yield an
:term:`iterable` object. An :term:`iterator` is created for that 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 iterator is exhausted,
The :token:`~python-grammar:starred_expression_list` expression is evaluated
once; it should yield an :term:`iterable` object. An :term:`iterator` is
created for that 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 iterator is exhausted,
the suite in the :keyword:`!else` clause,
if present, is executed, and the loop terminates.

Expand Down
2 changes: 1 addition & 1 deletion 2 Doc/reference/expressions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1928,7 +1928,7 @@ Expression lists
single: , (comma); expression list

.. productionlist:: python-grammar
starred_expression: ["*"] `or_expr`
starred_expression: "*" `or_expr` | `expression`
flexible_expression: `assignment_expression` | `starred_expression`
flexible_expression_list: `flexible_expression` ("," `flexible_expression`)* [","]
starred_expression_list: `starred_expression` ("," `starred_expression`)* [","]
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.