Skip to content
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

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

Merged
merged 8 commits into from
Jul 23, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Doc/tutorial/controlflow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
More Control Flow Tools
***********************

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
Contributor

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

that will be introduced in this chapter.
Copy link
Contributor

Choose a reason for hiding this comment

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

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



.. _tut-if:
Expand Down Expand Up @@ -166,7 +166,7 @@
The :keyword:`break` statement breaks out of the innermost enclosing
: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
Contributor

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.

Copy link
Contributor

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

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
Expand Down Expand Up @@ -520,7 +520,7 @@
:keyword:`!return` without an expression argument returns ``None``. Falling off
the end of a function also returns ``None``.

* The statement ``result.append(a)`` calls a *method* of the list object

Check warning on line 523 in Doc/tutorial/controlflow.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:meth reference target not found: append
``result``. A method is a function that 'belongs' to an object and is named
``obj.methodname``, where ``obj`` is some object (this may be an expression),
and ``methodname`` is the name of a method that is defined by the object's type.
Expand Down Expand Up @@ -1039,7 +1039,7 @@
information about the types used by user-defined functions (see :pep:`3107` and
:pep:`484` for more information).

:term:`Annotations <function annotation>` are stored in the :attr:`__annotations__`

Check warning on line 1042 in Doc/tutorial/controlflow.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:attr reference target not found: __annotations__
attribute of the function as a dictionary and have no effect on any other part of the
function. Parameter annotations are defined by a colon after the parameter name, followed
by an expression evaluating to the value of the annotation. Return annotations are
Expand Down
Loading