8000 bpo-35044: Use the :exc: role for the exceptions in the doc by matrixise · Pull Request #10037 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-35044: Use the :exc: role for the exceptions in the doc #10037

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

Merged
merged 7 commits into from
Oct 26, 2018
Merged
Show file tree
Hide file tree
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
Prev Previous commit
Next Next commit
Update with the recommendations of Serhiy
  • Loading branch information
matrixise committed Oct 22, 2018
commit 1c3c462c458cfe9660f048421775741366ec40dd
6 changes: 3 additions & 3 deletions Doc/howto/functional.rst
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,9 @@ Here's a sample usage of the ``generate_ints()`` generator:
You could equally write ``for i in generate_ints(5)``, or ``a, b, c =
generate_ints(3)``.

Inside a generator function, ``return value`` causes :exc:`StopIteration` to be
raised from the :meth:`~generator.__next__` method. Once this happens, or the
bottom of the function is reached, the procession of values ends and the
Inside a generator function, ``return value`` causes ``StopIteration(value)`` to
Copy link
Member

Choose a reason for hiding this comment

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

Ditto.

be raised from the :meth:`~generator.__next__` method. Once this happens, or
the bottom of the function is reached, the procession of values ends and the
generator cannot yield any further values.

You could achieve the effect of generators manually by writing your own class
Expand Down
6 changes: 3 additions & 3 deletions Doc/whatsnew/3.5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -560,15 +560,15 @@ PEP 479: Change StopIteration handling inside generators

The interaction of generators and :exc:`StopIteration` in Python 3.4 and
earlier was sometimes surprising, and could conceal obscure bugs. Previously,
:exc:`StopIteration` raised accidentally inside a generator function was
``StopIteration`` raised accidentally inside a generator function was
interpreted as the end of the iteration by the loop construct driving the
generator.

:pep:`479` changes the behavior of generators: when a :exc:`StopIteration`
:pep:`479` changes the behavior of generators: when a ``StopIteration``
exception is raised inside a generator, it is replaced with a
:exc:`RuntimeError` before it exits the generator frame. The main goal of
this change is to ease debugging in the situation where an unguarded
:func:`next` call raises :exc:`StopIteration` and causes the iteration controlled
:func:`next` call raises ``StopIteration`` and causes the iteration controlled
by the generator to terminate silently. This is particularly pernicious in
combination with the ``yield from`` construct.

Expand Down
0