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

gh-107017: removed mention that C does it the same way by JakubDotPy · Pull Request #107020 · python/cpython · GitHub

Repository navigation

gh-107017: removed mention that C does it the same way - #107020

Merged
hugovk merged 8 commits into
python:mainfrom
JakubDotPy:tutorial-docs-improvement
Jul 23, 2023
Merged

hugovk merged 8 commits into
python:mainfrom
JakubDotPy:tutorial-docs-improvement

Conversation

JakubDotPy commented Jul 22, 2023 •
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Contributor

Don't assume the reader knows the C language, especially in the tutorial.


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

Don't assume the reader knows the C language, especially in the tutorial.

ghost commented Jul 22, 2023 •
edited by ghost
Loading

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

the reader may not know any control flow statements or other languages,
also the "twists" may feel too intimidating
Comment thread 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

Copy link
Copy Markdown
Contributor

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

"As well as" would be more idiomatic English than "besides".

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

Copy link
Copy Markdown
Contributor

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

I think the line length needs to be checked here.

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

Copy link
Copy Markdown
Contributor

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

"... that we will encounter..."

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

Copy link
Copy Markdown
Contributor

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

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.

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

Copy link
Copy Markdown
Contributor

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

exemplified in

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

Copy link
Copy Markdown
Contributor

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

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 one else clause.)

hugovk added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Jul 23, 2023
hugovk merged commit 9629d44 into python:main Jul 23, 2023

Copy link
Copy Markdown
Contributor

Thanks @JakubDotPy for the PR, and @hugovk for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 23, 2023
…H-107020)

(cherry picked from commit 9629d44)

Co-authored-by: Jakub Červinka <cervinka.jakub.1989@gmail.com>

Copy link
Copy Markdown

GH-107097 is a backport of this pull request to the 3.12 branch.

bedevere-bot removed the needs backport to 3.12 only security fixes label Jul 23, 2023

Copy link
Copy Markdown

GH-107098 is a backport of this pull request to the 3.11 branch.

bedevere-bot removed the needs backport to 3.11 only security fixes label Jul 23, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 23, 2023
…H-107020)

(cherry picked from commit 9629d44)

Co-authored-by: Jakub Červinka <cervinka.jakub.1989@gmail.com>
hugovk pushed a commit that referenced this pull request Jul 23, 2023
) (#107097)

Co-authored-by: Jakub Červinka <cervinka.jakub.1989@gmail.com>
hugovk pushed a commit that referenced this pull request Jul 23, 2023
) (#107098)

Co-authored-by: Jakub Červinka <cervinka.jakub.1989@gmail.com>
JakubDotPy deleted the tutorial-docs-improvement branch July 23, 2023 10:48
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

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL