Skip to content

Commit ccd1133

Browse files
committed
crosslinks
1 parent 925b8dd commit ccd1133

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

docs/spec/namedtuples.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ in the base class::
5454
name: str # OK
5555
x: int # Type error (invalid override of named tuple field)
5656

57-
Namedtuple fields may be conditional, via checks of the same statically-known
58-
conditions that a type-checker understands elsewhere, such as Python version::
57+
Namedtuple fields may be conditional, via checks of the same
58+
:ref:`statically-known conditions<version-and-platform-checks>`
59+
that a type-checker understands elsewhere, such as Python version::
5960

6061
class ConditionalField(NamedTuple):
6162
x: int

docs/spec/typeddict.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,15 @@ in the class definition:
122122
:term:`read-only`. Other type qualifiers are not allowed. If the extra items type
123123
is ``Never``, no extra items are allowed, so this is equivalent to ``closed=True``.
124124

125-
The body of the class definition defines the :term:`items <item>` of the TypedDict type.
126-
It may also contain a docstring or ``pass`` statements (primarily to allow the creation of
127-
an empty TypedDict). `if` conditions that the type checker is able to
128-
statically evaluate are also permitted (e.g. `if sys.version_info > (3, 14)`),
129-
in order to specify items that exist only under the given conditions. No other
130-
statements are allowed, and type checkers should report an error if any are
131-
present. Type comments are not supported for creating TypedDict items.
125+
The body of the class definition defines the :term:`items <item>` of the
126+
TypedDict type. It may also contain a docstring or ``pass`` statements
127+
(primarily to allow the creation of an empty TypedDict). `if` conditions that
128+
the type checker is able to
129+
:ref:`statically evaluate<version-and-platform-checks>` are also permitted (e.g.
130+
`if sys.version_info > (3, 14)`), in order to specify items that exist only under
131+
the given conditions. No other statements are allowed, and type checkers should
132+
report an error if any are present. Type comments are not supported for
133+
creating TypedDict items.
132134

133135
.. _`required-notrequired`:
134136
.. _`required`:

0 commit comments

Comments
 (0)