GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-107017: removed mention that C does it the same way by JakubDotPy · Pull Request #107020 · python/cpython

Conversation

@JakubDotPy

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

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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

  • Issue: remove the assumptions from The tutorial #107017

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@JakubDotPy
removed mention that C does it the same way
5742c7e
Don't assume the reader knows the C language, especially in the tutorial.
@bedevere-bot bedevere-bot mentioned this pull request Jul 22, 2023
remove the assumptions from The tutorial #107017
Closed
@bedevere-bot bedevere-bot added awaiting review docs Documentation in the Doc dir skip news labels Jul 22, 2023
@ghost

ghost commented Jul 22, 2023 •
edited by ghost
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.
CLA signed

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@JakubDotPy
there are no "usual" flow control statements
67534f2
the reader may not know any control flow statements or other languages,
also the "twists" may feel too intimidating
evildmp
evildmp suggested changes Jul 22, 2023
View reviewed changes
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

@evildmp evildmp Jul 22, 2023

Copy link
Copy Markdown
Contributor

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".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
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

@evildmp evildmp Jul 22, 2023

Copy link
Copy Markdown
Contributor

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-bot bedevere-bot added awaiting core review and removed awaiting review labels Jul 22, 2023
evildmp
evildmp reviewed Jul 22, 2023
View reviewed changes
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.

@evildmp evildmp Jul 22, 2023

Copy link
Copy Markdown
Contributor

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..."

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
JakubDotPy added 2 commits July 22, 2023 15:42
@JakubDotPy
implemented suggestions
a588abc
@JakubDotPy
fixed typo and a line length
6acff0c
evildmp
evildmp suggested changes Jul 22, 2023
View reviewed changes
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.

@evildmp evildmp Jul 22, 2023

Copy link
Copy Markdown
Contributor

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
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::

@evildmp evildmp Jul 22, 2023

Copy link
Copy Markdown
Contributor

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
pochmann
pochmann reviewed Jul 22, 2023
View reviewed changes
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

@pochmann pochmann Jul 22, 2023

Copy link
Copy Markdown
Contributor

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
JakubDotPy added 4 commits July 22, 2023 16:37
@JakubDotPy
better structuring of the "else" explanation
5d08a1b
@JakubDotPy
removed links
e4f676a
@JakubDotPy
added keyword formatting
9c34614
@JakubDotPy
removed link
8f08838
evildmp
evildmp approved these changes Jul 22, 2023
View reviewed changes
@hugovk hugovk added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Jul 23, 2023
@hugovk
hugovk merged commit 9629d44 into python:main Jul 23, 2023
@bedevere-bot bedevere-bot removed the awaiting core review label Jul 23, 2023
@miss-islington

miss-islington commented 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.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 23, 2023
@JakubDotPy @miss-islington
pythongh-107017: removed mention that C does it the same way (pythonG…
6832b14
…H-107020)

(cherry picked from commit 9629d44)

Co-authored-by: Jakub Červinka <[email protected]>
@bedevere-bot

bedevere-bot commented Jul 23, 2023

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

bedevere-bot commented Jul 23, 2023

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot 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
@JakubDotPy @miss-islington
pythongh-107017: removed mention that C does it the same way (pythonG…
fe7db23
…H-107020)

(cherry picked from commit 9629d44)

Co-authored-by: Jakub Červinka <[email protected]>
hugovk pushed a commit that referenced this pull request Jul 23, 2023
@miss-islington @JakubDotPy
[3.12] gh-107017: removed mention that C does it the same way (GH-107020
98626c3
) (#107097)

Co-authored-by: Jakub Červinka <[email protected]>
hugovk pushed a commit that referenced this pull request Jul 23, 2023
@miss-islington @JakubDotPy
[3.11] gh-107017: removed mention that C does it the same way (GH-107020
7d41487
) (#107098)

Co-authored-by: Jakub Červinka <[email protected]>
@JakubDotPy
JakubDotPy deleted the tutorial-docs-improvement branch July 23, 2023 10:48
jtcave pushed a commit to jtcave/cpython that referenced this pull request Jul 23, 2023
@JakubDotPy @jtcave
pythongh-107017: removed mention that C does it the same way (python#…
593c34b
…107020)
mementum pushed a commit to mementum/cpython that referenced this pull request Jul 23, 2023
@JakubDotPy @mementum
pythongh-107017: removed mention that C does it the same way (python#…
310639c
…107020)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

2 more reviewers
@pochmann pochmann pochmann left review comments
@evildmp evildmp evildmp approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

docs Documentation in the Doc dir skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@JakubDotPy @miss-islington @bedevere-bot @evildmp @pochmann @hugovk
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.