@@ -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
@@ -1483,7 +1483,7 @@ These can be used as types in annotations. They all support subscription using
1483
1483
Typing operator to conceptually mark an object as having been unpacked.
1484
1484
1485
1485
For example, using the unpack operator ``* `` on a
1486
- :class : `type variable tuple <TypeVarTuple > ` is equivalent to using ``Unpack ``
1486
+ :ref : `type variable tuple <typevartuple >` is equivalent to using ``Unpack ``
1487
1487
to mark the type variable tuple as having been unpacked::
1488
1488
1489
1489
Ts = TypeVarTuple('Ts')
@@ -1574,6 +1574,8 @@ without the dedicated syntax, as documented below.
1574
1574
...
1575
1575
# Etc.
1576
1576
1577
+ .. _typevar :
1578
+
1577
1579
.. class :: TypeVar(name, *constraints, bound=None, covariant=False, contravariant=False, infer_variance=False)
1578
1580
1579
1581
Type variable.
@@ -1718,9 +1720,11 @@ without the dedicated syntax, as documented below.
1718
1720
:ref: `type parameter <type-params >` syntax introduced by :pep: `695 `.
1719
1721
The ``infer_variance `` parameter was added.
1720
1722
1723
+ .. _typevartuple :
1724
+
1721
1725
.. class :: TypeVarTuple(name)
1722
1726
1723
- Type variable tuple. A specialized form of :class : `type variable <TypeVar > `
1727
+ Type variable tuple. A specialized form of :ref : `type variable <typevar >`
1724
1728
that enables *variadic * generics.
1725
1729
1726
1730
Type variable tuples can be declared in :ref: `type parameter lists <type-params >`
@@ -1838,7 +1842,7 @@ without the dedicated syntax, as documented below.
1838
1842
.. class :: ParamSpec(name, *, bound=None, covariant=False, contravariant=False)
1839
1843
1840
1844
Parameter specification variable. A specialized version of
1841
- :class : `type variables <TypeVar > `.
1845
+ :ref : `type variables <typevar >`.
1842
1846
1843
1847
8036
td> In :ref: `type parameter lists <type-params >`, parameter specifications
1844
1848
can be declared with two asterisks (``** ``)::
@@ -2749,6 +2753,8 @@ Functions and decorators
2749
2753
2750
2754
.. versionadded :: 3.11
2751
2755
2756
+ .. _overload :
2757
+
2752
2758
.. decorator :: overload
2753
2759
2754
2760
Decorator for creating overloaded functions and methods.
0 commit comments