PEP 661: fix links and tweak some wording (#1980)

This commit is contained in:
Tal Einat 2021-06-06 11:32:34 +03:00 committed by GitHub
parent b368a5a4be
commit 910d060988
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 12 deletions

View File

@ -36,17 +36,12 @@ Motivation
In May 2021, a question was brought up on the python-dev mailing list
[#python-dev-thread]_ about how to better implement a sentinel value for
``traceback.print_exception``. The existing implementation used the
following common idiom:
::
following common idiom::
_sentinel = object()
However, this object has an overly verbose repr, causing the function's
signature to be overly long and hard to read, as seen e.g. when calling
``help()``:
::
However, this object has an uninformative and overly verbose repr, causing the
function's signature to be overly long and hard to read::
>>> help(traceback.print_exception)
Help on function print_exception in module traceback:
@ -73,7 +68,7 @@ The discussion did not lead to any clear consensus on whether a standard
implementation method is needed or desirable, whether the drawbacks mentioned
are significant, nor which kind of implementation would be good.
A poll was created on discuss.python.org [#poll]_to get a clearer sense of
A poll was created on discuss.python.org [#poll]_ to get a clearer sense of
the community's opinions. The poll's results were not conclusive, with 40%
voting for "The status-quo is fine / theres no need for consistency in
this", but most voters voting for one or more standardized solutions.
@ -184,8 +179,8 @@ with confidence without needing to consider potential edge-cases.
Additionally, it is useful to be able to provide a meaningful name and repr
for a sentinel value, specific to the context where it is used.
Finally, this was a very unpopular option in the poll, with only 12% of
the votes voting for it.
Finally, this was a very unpopular option in the poll [#poll]_, with only 12%
of the votes voting for it.
Use the existing ``Ellipsis`` sentinel value
@ -297,10 +292,10 @@ Additional Notes
References
==========
.. [#reference-github-repo] `Reference implementation at the taleinat/python-stdlib-sentinels GitHub repo <https://github.com/taleinat/python-stdlib-sentinels>`_
.. [#python-dev-thread] Python-Dev mailing list: `The repr of a sentinel <https://mail.python.org/archives/list/python-dev@python.org/thread/ZLVPD2OISI7M4POMTR2FCQTE6TPMPTO3/>`_
.. [#list-of-sentinels-in-stdlib] Python-Dev mailing list: `"The stdlib contains tons of sentinels" <https://mail.python.org/archives/list/python-dev@python.org/message/JBYXQH3NV3YBF7P2HLHB5CD6V3GVTY55/>`_
.. [#poll] discuss.python.org Poll: `Sentinel Values in the Stdlib <https://discuss.python.org/t/sentinel-values-in-the-stdlib/8810/>`_
.. [#reference-github-repo] `Reference implementation at the taleinat/python-stdlib-sentinels GitHub repo <https://github.com/taleinat/python-stdlib-sentinels>`_
.. [5] `bpo-44123: Make function parameter sentinel values true singletons <https://bugs.python.org/issue44123>`_
.. [6] `The "sentinels" package on PyPI <https://pypi.org/project/sentinels/>`_
.. [7] `The "sentinel" package on PyPI <https://pypi.org/project/sentinel/>`_