Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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

Sign up
Appearance settings

Commit6ea83e0

Browse files
[3.14]gh-134026: Fix grammar description of for statement (GH-134034) (GH-134424)
gh-134026: Fix grammar description of for statement (GH-134034)(cherry picked from commit4eacf38)Co-authored-by: Yash Vijay <yash_vijay@outlook.com>
1 parentcdc92cd commit6ea83e0

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

‎Doc/reference/compound_stmts.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,15 @@ 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" `starred_list` ":" `suite`
157+
for_stmt: "for" `target_list` "in" `starred_expression_list` ":" `suite`
158158
: ["else" ":" `suite`]
159159

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 thenassigned to the target list using the standard
164-
rules for assignments(see:ref:`assignment`), and the suite is executed.This
165-
repeats for eachitem provided by the iterator. When the iterator is exhausted,
160+
The:token:`~python-grammar:starred_expression_list` expression is evaluated
161+
once; it should yield an:term:`iterable` object. An:term:`iterator` is
162+
created for that iterable.The first item provided by the iterator is then
163+
assigned to the target list using the standard rules for assignments
164+
(see:ref:`assignment`), and the suite is executed. This repeats for each
165+
item provided by the iterator. When the iterator is exhausted,
166166
the suite in the:keyword:`!else` clause,
167167
if present, is executed, and the loop terminates.
168168

‎Doc/reference/expressions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1928,7 +1928,7 @@ Expression lists
19281928
single: , (comma); expression list
19291929

19301930
..productionlist::python-grammar
1931-
starred_expression:["*"] `or_expr`
1931+
starred_expression: "*" `or_expr` | `expression`
19321932
flexible_expression: `assignment_expression` | `starred_expression`
19331933
flexible_expression_list: `flexible_expression` ("," `flexible_expression`)* [","]
19341934
starred_expression_list: `starred_expression` ("," `starred_expression`)* [","]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp