FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-134026: Fix grammar description of for statement by Yash-Vijay29 · Pull Request #134034 · python/cpython · GitHub

/ cpython Public

gh-134026: Fix grammar description of for statement - #134034

Merged
encukou merged 26 commits into
python:mainfrom
Yash-Vijay29:fix-for-stmt-docs
May 21, 2025
Merged

gh-134026: Fix grammar description of for statement#134034
encukou merged 26 commits into
python:mainfrom
Yash-Vijay29:fix-for-stmt-docs

Conversation

Yash-Vijay29 commented May 15, 2025
edited
Loading

Copy link
Copy Markdown
Contributor

What’s changed

  • In Doc/reference/compound_stmts.rst, replaced the undefined starred_list token with the actual grammar production starred_expression_list in the for_stmt rule.

Why

Backwards compatibility

  • This is purely a docs change; there’s no impact on existing code or behavior.

Further notes



📚 Documentation preview 📚: https://cpython-previews--134034.org.readthedocs.build/

python-cla-bot Bot commented May 15, 2025
edited
Loading

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

Comment thread Doc/reference/compound_stmts.rst Outdated

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:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Please see warnings on your pr.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Why this comma? Seems unrelated to the pr content.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@StanFromIreland, does this looks correct for you?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

skirpichev marked this pull request as draft May 15, 2025 09:39

Copy link
Copy Markdown
Contributor Author

@skirpichev do i need to fix something? i dont know what being marked as draft is suppose to imply

skirpichev self-requested a review May 15, 2025 10:23

StanFromIreland left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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)

Comment thread Doc/reference/compound_stmts.rst Outdated
Comment thread Doc/reference/compound_stmts.rst Outdated
Yash-Vijay29 marked this pull request as ready for review May 16, 2025 04:43

StanFromIreland left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Minor change needed otherwise good to go

Comment thread Doc/reference/compound_stmts.rst Outdated

serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM, but please fix long lines.

Comment thread 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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Comment thread Doc/reference/compound_stmts.rst Outdated
Comment thread Doc/reference/compound_stmts.rst Outdated

Copy link
Copy Markdown

Thanks @Yash-Vijay29 for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

encukou commented May 21, 2025

Copy link
Copy Markdown
Member

Thank you for the fix!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 21, 2025
…34034)

(cherry picked from commit 4eacf38)

Co-authored-by: Yash Vijay <yash_vijay@outlook.com>

bedevere-app Bot commented May 21, 2025

Copy link
Copy Markdown

GH-134424 is a backport of this pull request to the 3.14 branch.

bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label May 21, 2025
Yash-Vijay29 deleted the fix-for-stmt-docs branch May 21, 2025 15:55
encukou pushed a commit that referenced this pull request May 21, 2025
GH-134424)

gh-134026: Fix grammar description of for statement (GH-134034)
(cherry picked from commit 4eacf38)

Co-authored-by: Yash Vijay <yash_vijay@outlook.com>
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
gostak-dd pushed a commit to gostak-dd/cpython that referenced this pull request Jun 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL