8000 PEP 678: Convert footnotes to inline links · Zac-HD/peps@a613c6c · GitHub
[go: up one dir, main page]

Skip to content

Commit a613c6c

Browse files
committed
PEP 678: Convert footnotes to inline links
Per python#2302.
1 parent 84bbab8 commit a613c6c

File tree

1 file changed

+24
-27
lines changed

1 file changed

+24
-27
lines changed

pep-0678.rst

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,16 @@ includes a note of the minimal failing example::
115115
Non-goals
116116
---------
117117
``__note__`` is *not* intended to carry structured data. If your note is for
118-
use by a program rather than display to a human, we recommend instead (or
119-
additionally) choosing a convention for an attribute like e.g.
120-
``err._parse_errors = ...`` on the error or ``ExceptionGroup`` [1]_ [2]_
118+
use by a program rather than display to a human, `we recommend
119+
<https://discuss.python.org/t/accepting-pep-654-exception-groups-and-except/10813/26>`__
120+
instead (or additionally) choosing a convention for an attribute, e.g.
121+
``err._parse_errors = ...`` on the error or ``ExceptionGroup``.
121122

122123
As a rule of thumb, prefer `exception chaining
123124
<https://docs.python.org/3/tutorial/errors.html#exception-chaining>`__ when the
124125
error is going to be re-raised or handled as an individual error, and prefer
125126
``__note__`` when you are collecting multiple exception objects to handle
126-
together or later. [3]_
127+
together or later. [1]_
127128

128129

129130
Specification
@@ -149,8 +150,9 @@ Backwards Compatibility
149150
=======================
150151

151152
System-defined or "dunder" names (following the pattern ``__*__``) are part of
152-
the language specification, with unassigned names reserved for future use and
153-
subject to breakage without warning [4]_.
153+
the language specification, with `unassigned names reserved for future use and
154+
subject to breakage without warning
155+
<https://docs.python.org/3/reference/lexical_analysis.html#reserved-classes-of-identifiers>`__.
154156

155157
We are also unaware of any code which *would* be broken by adding ``__note__``;
156158
assigning to a ``.__note__`` attribute already *works* on current versions of
@@ -163,16 +165,15 @@ How to Teach This
163165
=================
164166

165167
The ``__note__`` attribute will be documented as part of the language standard,
166-
and explained as part of the tutorial "Errors and Exceptions" [5]_.
167-
168+
and explained as part of `the "Errors and Exceptions" tutorial
169+
<https://github.com/python/cpython/pull/30441>`__.
168170

169171

170172
Reference Implementation
171173
========================
172174

173-
``BaseException.__note__`` was implemented in [6]_ and released in CPython
174-
3.11.0a3, following discussions related to :pep:`654`. [7]_ [8]_ [9]_
175-
175+
``BaseException.__note__`` was `implemented in <https://github.com/python/cpython/pull/29880>`__ and released in CPython
176+
3.11.0a3, following discussions related to :pep:`654`. [2]_
176177

177178

178179
Rejected Ideas
@@ -204,8 +205,9 @@ for downstream code. We consider *always* raising a ``Wrapper`` exception
204205
unacceptably inelegant; but because custom exception types might have any
205206
number of required arguments we can't always create an instance of the *same*
206207
type with our explanation. In cases where the exact exception type is known
207-
this can work, such as the standard library ``http.client`` code [10]_, but not
208-
for libraries which call user code.
208+
this can work, such as the standard library ``http.client`` `code
209+
<https://github.com/python/cpython/blob/69ef1b59983065ddb0b712dac3b04107c5059735/Lib/http/client.py#L596-L597>`__,
210+
but not for libraries which call user code.
209211

210212
Second, exception chaining reports several lines of additional detail, which
211213
are distracting for experienced users and can be very confusing for beginners.
@@ -297,9 +299,11 @@ formatted for display after propagation.
297299

298300
Add a helper function ``contextlib.add_exc_note()``
299301
---------------------------------------------------
300-
It was suggested [11]_ that we add a utility such as the one below to the
301-
standard library. We are open to this idea, but do not see it as a core part of
302-
the proposal of this PEP as it can be added as an enhancement later.
302+
It `was suggested
303+
<https://www.reddit.com/r/Python/comments/rmrvxv/pep_678_enriching_exceptions_with_notes/hptbul1/>`__
304+
that we add a utility such as the one below to the standard library. We are
305+
open to this idea, but do not see it as a core part of the proposal of this PEP
306+
as it can be added as an enhancement later.
303307

304308
.. code-block:: python
305309
@@ -329,19 +333,12 @@ justifies new language syntax.
329333
References
330334
==========
331335

332-
.. [1] https://discuss.python.org/t/accepting-pep-654-exception-groups-and-except/10813/26
333-
.. [2] https://bugs.python.org/issue46431
334-
.. [3] this principle was established in the 2003 mail thread which led to :pep:`3134`,
336+
.. [1] this principle was established in the 2003 mail thread which led to :pep:`3134`,
335337
and included a proposal for a group-of-exceptions type!
336338
https://mail.python.org/pipermail/python-dev/2003-January/032492.html
337-
.. [4] https://docs.python.org/3/reference/lexical_analysis.html#reserved-classes-of-identifiers
338-
.. [5] https://github.com/python/cpython/pull/30441
339-
.. [6] https://github.com/python/cpython/pull/29880
340-
.. [7] https://discuss.python.org/t/accepting-pep-654-exception-groups-and-except/10813/9
341-
.. [8] https://github.com/python/cpython/pull/28569#discussion_r721768348
342-
.. [9] https://bugs.python.org/issue45607
343-
.. [10] https://github.com/python/cpython/blob/69ef1b59983065ddb0b712dac3b04107c5059735/Lib/http/client.py#L596-L597
344-
.. [11] https://www.reddit.com/r/Python/comments/rmrvxv/pep_678_enriching_exceptions_with_notes/hptbul1/
339+
.. [2] particularly those at https://bugs.python.org/issue45607,
340+
https://discuss.python.org/t/accepting-pep-654-exception-groups-and-except/10813/9,
341+
https://github.com/python/cpython/pull/28569#discussion_r721768348, and
345342
346343
347344

0 commit comments

Comments
 (0)
0