Skip to content

Commit

Permalink
fix lint errors. Add Rationale headline
Browse files Browse the repository at this point in the history
  • Loading branch information
iritkatriel committed Nov 15, 2024
1 parent c895bb8 commit e975cd3
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions peps/pep-9999.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ this change, which did not exist at the time that :pep:`601`
was rejected. It also proposes a slightly different solution
than that which was proposed by :pep:`601`.

Rationale
=========
Motivation
==========

The semantics of ``return``, ``break`` and ``continue`` in a
finally block are surprising for many developers.
Expand All @@ -47,6 +47,9 @@ Indeed, :pep:`8` now recommends not to use control flow statements
in a ``finally`` block, and linters such as pylint [2]_, ruff [3]_
and flake8-bugbear [4]_ flag them as a problem.

Rationale
=========

A recent analysis of real world code [5]_ shows that::

- These features are rare (2 per million LOC in the top 8000 PyPI
Expand All @@ -63,7 +66,7 @@ Python itself moved them away from this harmful feature.
One of the arguments brought up [6]_ in the discussion about :pep:`601`
was that language features should be orthogonal, and combine without
context-based restrictions. However, in the meantime :pep:`654` has
been implemented, and it forbids `return`, `break` and `continue`
been implemented, and it forbids ``return``, ``break`` and ``continue`
in an ``except*`` clause because the semantics of that would violate
the property that ``except*`` clauses operate *in parallel*, so the
code of one clause should not suppress the invocation of another.
Expand Down Expand Up @@ -138,7 +141,7 @@ How to Teach This
=================

The change will be documented in the language spec and in the
What's New documentation. The `SyntaxWarning` will alert users
What's New documentation. The ``SyntaxWarning`` will alert users
that their code needs to change. The empirical evidence [5]_
shows that the changes necessary are typically quite
straightforward.
Expand Down

0 comments on commit e975cd3

Please sign in to comment.