@@ -304,7 +304,7 @@ a callable with any arbitrary parameter list would be acceptable:
304
304
x = concat # Also OK
305
305
306
306
``Callable `` cannot express complex signatures such as functions that take a
307
- variadic number of arguments, :func : `overloaded functions <overload> `, or
307
+ variadic number of arguments, :ref : `overloaded functions <overload >`, or
308
308
functions that have keyword-only parameters. However, these signatures can be
309
309
expressed by defining a :class: `Protocol ` class with a
310
310
:meth: `~object.__call__ ` method:
@@ -526,7 +526,7 @@ A user-defined class can be defined as a generic class.
526
526
self.logger.info('%s: %s', self.name, message)
527
527
528
528
This syntax indicates that the class ``LoggedVar `` is parameterised around a
529
- single :class : `type variable <TypeVar > ` ``T `` . This also makes ``T `` valid as
529
+ single :ref : `type variable <typevar >` ``T `` . This also makes ``T `` valid as
530
530
a type within the class body.
531
531
532
532
Generic classes implicitly inherit from :class: `Generic `. For compatibility
@@ -1493,7 +1493,7 @@ These can be used as types in annotations. They all support subscription using
1493
1493
Typing operator to conceptually mark an object as having been unpacked.
1494
1494
1495
1495
For example, using the unpack operator ``* `` on a
1496
- :class : `type variable tuple <TypeVarTuple > ` is equivalent to using ``Unpack ``
1496
+ :ref : `type variable tuple <typevartuple >` is equivalent to using ``Unpack ``
1497
1497
to mark the type variable tuple as having been unpacked::
1498
1498
1499
1499
Ts = TypeVarTuple('Ts')
@@ -1584,6 +1584,8 @@ without the dedicated syntax, as documented below.
1584
1584
...
1585
1585
# Etc.
1586
1586
1587
+ .. _typevar :
1588
+
1587
1589
.. class :: TypeVar(name, *constraints, bound=None, covariant=False, contravariant=False, infer_variance=False)
1588
1590
1589
1591
Type variable.
@@ -1728,9 +1730,11 @@ without the dedicated syntax, as documented below.
1728
1730
:ref: `type parameter <type-params >` syntax introduced by :pep: `695 `.
1729
1731
The ``infer_variance `` parameter was added.
1730
1732
1733
+ .. _typevartuple :
1734
+
1731
1735
.. class :: TypeVarTuple(name)
1732
1736
1733
- Type variable tuple. A specialized form of :class : `type variable <TypeVar > `
1737
<
6D47
/td>+ Type variable tuple. A specialized form of :ref : `type variable <typevar >`
1734
1738
that enables *variadic * generics.
1735
1739
1736
1740
Type variable tuples can be declared in :ref: `type parameter lists <type-params >`
@@ -1848,7 +1852,7 @@ without the dedicated syntax, as documented below.
1848
1852
.. class :: ParamSpec(name, *, bound=None, covariant=False, contravariant=False)
1849
1853
1850
1854
Parameter specification variable. A specialized version of
1851
- :class : `type variables <TypeVar > `.
1855
+ :ref : `type variables <typevar >`.
1852
1856
1853
1857
In :ref: `type parameter lists <type-params >`, parameter specifications
1854
1858
can be declared with two asterisks (``** ``)::
@@ -2772,6 +2776,8 @@ Functions and decorators
2772
2776
2773
2777
.. versionadded :: 3.11
2774
2778
2779
+ .. _overload :
2780
+
2775
2781
.. decorator :: overload
2776
2782
2777
2783
Decorator for creating overloaded functions and methods.
0 commit comments