-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-134026: Fix grammar description of for statement #134034
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Doc/reference/compound_stmts.rst
Outdated
@@ -151,21 +151,22 @@ The :keyword:`!for` statement | |||
single: : (colon); compound statement | |||
|
|||
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: | |||
(such as a string, tuple, or list) or other iterable object: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see warnings on your pr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay yea saw it. found a "starred_expression_list" in the https://docs.python.org/3/reference/expressions.html#grammar-token-python-grammar-starred_expression_list. I will try to link it to that instead then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skirpichev done, i reviewed it locally and doc seems proper. starred_list is turned into starred_expression_list mentioned already in https://docs.python.org/3/reference/expressions.html#grammar-token-python-grammar-starred_expression_list
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this comma? Seems unrelated to the pr content.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this comma? Seems unrelated to the pr content.
While changing i just noticed a small grammar error and thought of fixing it. Its a small mistake but comma should be there after the tuple, I can make a separate PR for it if you want
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@StanFromIreland, does this looks correct for you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is an oxford comma, its usage is varied across contexts, but generally recommended in formal writing.
It is unrelated to this pr and not very important, I am not against it staying, but I wouldn't be heavily opposed to removing it either.
9967ec9
to
e760500
Compare
@skirpichev do i need to fix something? i dont know what being marked as draft is suppose to imply |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can mark it as ready for review whenever you feel it is. Currently it is not.
See my comments, and I recommended you read the devguide. (Sections on documentation and pr lifecycle will be particularly handy now)
…stmt-docs # Conflicts: # Doc/reference/compound_stmts.rst
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor change needed otherwise good to go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but please fix long lines.
Doc/reference/compound_stmts.rst
Outdated
The first item provided | ||
by the iterator is then assigned to the target list using the standard | ||
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you change this line in any case, please break it between sentences. Otherwise the line is too long. Even if the linter is silent, the recommended size is less than 80 columns.
Thanks @Yash-Vijay29 for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
Thank you for the fix! |
GH-134424 is a backport of this pull request to the 3.14 branch. |
What’s changed
Doc/reference/compound_stmts.rst
, replaced the undefinedstarred_list
token with the actual grammar productionstarred_expression_list
in thefor_stmt
rule.Why
starred_list
is not linked to anything, i believe it was a typo for 'starred_expression_list" that exists in https://docs.python.org/3/reference/expressions.html#grammar-token-python-grammar-starred_expression_listBackwards compatibility
Further notes
starred_expression_list
.📚 Documentation preview 📚: https://cpython-previews--134034.org.readthedocs.build/