Skip to content

Commit 2849a58

Browse files
authored
PEP 593: Fix citation references (#2640)
* PEP 593: Remove orphan citation to fix build warning * PEP 593: Inline the references to fix warnings
1 parent 52e6c45 commit 2849a58

File tree

1 file changed

+22
-27
lines changed

1 file changed

+22
-27
lines changed

pep-0593.rst

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,14 @@ should ignore it and simply treat the type as ``T``. Unlike the
4343
``no_type_check`` functionality that currently exists in the ``typing``
4444
module which completely disables typechecking annotations on a function
4545
or a class, the ``Annotated`` type allows for both static typechecking
46-
of ``T`` (e.g., via mypy [mypy]_ or Pyre [pyre]_, which can safely ignore ``x``)
46+
of ``T`` (e.g., via `mypy <mypy_>`_ or `Pyre <pyre_>`_,
47+
which can safely ignore ``x``)
4748
together with runtime access to ``x`` within a specific application. The
4849
introduction of this type would address a diverse set of use cases of interest
4950
to the broader Python community.
5051

51-
This was originally brought up as issue 600 [issue-600]_ in the typing github
52-
and then discussed in Python ideas [python-ideas]_.
52+
This was originally brought up as `issue 600 <issue-600_>`_ in the typing github
53+
and then discussed in `Python ideas <python-ideas_>`_.
5354

5455
Motivating examples
5556
-------------------
@@ -81,21 +82,21 @@ Lowering barriers to developing new typing constructs
8182
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8283

8384
Typically when adding a new type, a developer need to upstream that type to the
84-
typing module and change mypy, PyCharm [pycharm]_, Pyre, pytype [pytype]_,
85+
typing module and change mypy, `PyCharm <pycharm_>`_, Pyre, `pytype <pytype_>`_,
8586
etc...
8687
This is particularly important when working on open-source code that
8788
makes use of these types, seeing as the code would not be immediately
8889
transportable to other developers' tools without additional logic. As a result,
8990
there is a high cost to developing and trying out new types in a codebase.
9091
Ideally, authors should be able to introduce new types in a manner that allows
91-
for graceful degradation (e.g.: when clients do not have a custom mypy plugin
92-
[mypy-plugin]_), which would lower the barrier to development and ensure some
92+
for graceful degradation (e.g.: when clients do not have a custom `mypy plugin
93+
<mypy-plugin_>`_), which would lower the barrier to development and ensure some
9394
degree of backward compatibility.
9495

95-
For example, suppose that an author wanted to add support for tagged unions
96-
[tagged-union]_ to Python. One way to accomplish would be to annotate
97-
``TypedDict`` [typed-dict]_ in Python such that only one field is allowed to be
98-
set::
96+
For example, suppose that an author wanted to add support for `tagged unions
97+
<tagged-union_>`_ to Python. One way to accomplish would be to `annotate
98+
<typed-dict_>`_ ``TypedDict`` in Python such that only one field is allowed
99+
to be set::
99100

100101
Currency = Annotated[
101102
TypedDict('Currency', {'dollars': float, 'pounds': float}, total=False),
@@ -236,7 +237,7 @@ cause ``Annotated`` to not integrate cleanly with the other typing annotations:
236237
* ``Annotated`` cannot infer the decorated type. You could imagine that
237238
``Annotated[..., Immutable]`` could be used to mark a value as immutable
238239
while still inferring its type. Typing does not support using the
239-
inferred type anywhere else [issue-276]_; it's best to not add this as a
240+
inferred type `anywhere else <issue-276_>`_; it's best to not add this as a
240241
special case.
241242

242243
* Using ``(Type, Ann1, Ann2, ...)`` instead of
@@ -253,40 +254,34 @@ This feature was left out to keep the design simple:
253254
little benefit.
254255

255256

256-
References
257-
----------
258-
259-
.. [issue-600]
257+
.. _issue-600:
260258
https://github.com/python/typing/issues/600
261259

262-
.. [python-ideas]
260+
.. _python-ideas:
263261
https://mail.python.org/pipermail/python-ideas/2019-January/054908.html
264262

265-
.. [struct-doc]
266-
https://docs.python.org/3/library/struct.html#examples
267-
268-
.. [mypy]
263+
.. _mypy:
269264
http://www.mypy-lang.org/
270265

271-
.. [pyre]
266+
.. _pyre:
272267
https://pyre-check.org/
273268

274-
.. [pycharm]
269+
.. _pycharm:
275270
https://www.jetbrains.com/pycharm/
276271

277-
.. [pytype]
272+
.. _pytype:
278273
https://github.com/google/pytype
279274

280-
.. [mypy-plugin]
275+
.. _mypy-plugin:
281276
https://github.com/python/mypy_extensions
282277

283-
.. [tagged-union]
278+
.. _tagged-union:
284279
https://en.wikipedia.org/wiki/Tagged_union
285280

286-
.. [typed-dict]
281+
.. _typed-dict:
287282
https://mypy.readthedocs.io/en/latest/more_types.html#typeddict
288283

289-
.. [issue-276]
284+
.. _issue-276:
290285
https://github.com/python/typing/issues/276
291286

292287
Copyright

0 commit comments

Comments
 (0)