Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
gh-107017: removed mention that C does it the same way#107020
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
JakubDotPy commented Jul 22, 2023 • edited by github-actions bot
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by github-actions bot
Uh oh!
There was an error while loading. Please reload this page.
Don't assume the reader knows the C language, especially in the tutorial.
ghost commented Jul 22, 2023 • edited by ghost
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by ghost
Uh oh!
There was an error while loading. Please reload this page.
the reader may not know any control flow statements or other languages, also the "twists" may feel too intimidating
Doc/tutorial/controlflow.rst Outdated
| Besides the :keyword:`while` statement just introduced, Python uses the usual | ||
| flow control statements known from other languages, with some twists. | ||
| Besides the :keyword:`while` statement just introduced, Python uses a few more |
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.
"As well as" would be more idiomatic English than "besides".
Doc/tutorial/controlflow.rst Outdated
| :keyword:`for` or :keyword:`while` loop. | ||
| Loop statements may have an :keyword:`!else` clause; it is executed when the loop | ||
| The :keyword:`for` loop statements may have an extra:keyword:`!else` clause; it is executed when the loop |
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.
I think the line length needs to be checked here.
Doc/tutorial/controlflow.rst Outdated
| Besides the :keyword:`while` statement just introduced, Python uses the usual | ||
| flow control statements known from other languages, with some twists. | ||
| Besides the :keyword:`while` statement just introduced, Python uses a few more | ||
| that will be introduced in this chapter. |
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.
"... that we will encounter..."
Doc/tutorial/controlflow.rst Outdated
| The :keyword:`for` loop statements may have an extra :keyword:`!else` clause; | ||
| it is executed when the loop terminates through exhaustion of the iterable | ||
| (with :keyword:`for`) or when the condition becomes false (with :keyword:`while`), | ||
| but not when the loop is terminated by a :keyword:`break` statement. |
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.
I find the original language here rather hard to parse because the concepts are quite unfamiliar (a loop that terminates through exhaustion of an iterable...).
Perhaps:
A for or while loop can include an else clause.
In a for loop, the else clause is executed after the loop reaches its final iteration. In a while loop, it's executed after the loop's condition becomes false.
In either kind of loop, the else clause is not executed if the loop was terminated by a break.
Doc/tutorial/controlflow.rst Outdated
| it is executed when the loop terminates through exhaustion of the iterable | ||
| (with :keyword:`for`) or when the condition becomes false (with :keyword:`while`), | ||
| but not when the loop is terminated by a :keyword:`break` statement. | ||
| This is exemplified by the following loop, which searches for prime numbers:: |
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.
exemplified in
Doc/tutorial/controlflow.rst Outdated
| :keyword:`for` or :keyword:`while` loop. | ||
| Loop statements may have an :keyword:`!else` clause; it is executed when the loop | ||
| The :keyword:`for` loop statements may have an extra:keyword:`!else` clause; it is executed when the loop |
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.
This just seems bad. You restricted it to for statements, but it also applies to while statements. And the else clause isn't really "extra" (I even checked some dictionaries, they all defined it like "added to an existing or usual amount or number; additional. Example: they offered him an extra thirty-five cents an hour". And loop statements can only have oneelse clause.)
miss-islington commented Jul 23, 2023
Thanks @JakubDotPy for the PR, and @hugovk for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
bedevere-bot commented Jul 23, 2023
GH-107097 is a backport of this pull request to the 3.12 branch. |
bedevere-bot commented Jul 23, 2023
GH-107098 is a backport of this pull request to the 3.11 branch. |
Don't assume the reader knows the C language, especially in the tutorial.
📚 Documentation preview 📚: https://cpython-previews--107020.org.readthedocs.build/