Skip to content

Commit ac70ae1

Browse files
committed
Link fixes
Also, replace class names with links to the Python docs
1 parent 7c5dfc5 commit ac70ae1

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

docs/guides/libraries.rst

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -460,14 +460,19 @@ When writing a library with a couple of decorator factories
460460
:ref:`annotating-decorators` section) it may be tempting to create a shortcut
461461
for a decorator.
462462

463-
Different type checkers handle ``TypeAlias`` involving ``Callable`` in a
463+
Different type checkers handle :class:`TypeAlias <typing.TypeAlias>` involving
464+
:class:`Callable <collections.abc.Callable>` in a
464465
different manner, so the most portable and easy way to create a shortcut
465-
is to define a callable ``Protocol`` as described in `PEP
466-
544 <https://peps.python.org/pep-0544/#callback-protocols>`_.
466+
is to define a callable :class:`Protocol <typing.Protocol>` as described in the
467+
:ref:`callback-protocols` section of the Typing Specification.
467468

468-
There is already a ``Protocol`` called ``IdentityFunction`` defined in `_typeshed <https://github.com/python/typeshed/blob/master/stdlib/_typeshed/README.md>`_:
469+
There is already a :class:`Protocol <typing.Protocol>` called
470+
``IdentityFunction`` defined in
471+
`_typeshed <https://github.com/python/typeshed/blob/main/stdlib/_typeshed/README.md>`_:
469472

470473
.. code:: python
474+
475+
from typing import TYPE_CHECKING
471476
472477
if TYPE_CHECKING:
473478
from _typeshed import IdentityFunction
@@ -481,9 +486,8 @@ There is already a ``Protocol`` called ``IdentityFunction`` defined in `_typeshe
481486
...
482487
483488
For non-trivial decorators with custom logic, it is still possible
484-
to define a custom protocol using ``ParamSpec`` and ``Concatenate``
485-
mechanisms described in `PEP 612
486-
<https://www.python.org/dev/peps/pep-0612/>`__:
489+
to define a custom protocol using :class:`ParamSpec <typing.ParamSpec>`
490+
and :class:`Concatenate <typing.Concatenate>` mechanisms:
487491

488492
.. code:: python
489493

0 commit comments

Comments
 (0)