Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2f7b5e4

Browse files
Minor improvements to typing docs (#104465)
1 parent178153c commit2f7b5e4

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

‎Doc/library/typing.rst‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
This module provides runtime support for type hints. The most fundamental
2121
support consists of the types:data:`Any`,:data:`Union`,:data:`Callable`,
22-
:class:`TypeVar`, and:class:`Generic`. For afullspecification, please see
22+
:class:`TypeVar`, and:class:`Generic`. For a specification, please see
2323
:pep:`484`. For a simplified introduction to type hints, see:pep:`483`.
2424

2525

@@ -592,7 +592,7 @@ The module defines the following classes, functions and decorators.
592592
when the checked program targets Python 3.9 or newer.
593593

594594
The deprecated types will be removed from the:mod:`typing` module
595-
in the first Python version released 5 years after the release of Python 3.9.0.
595+
no sooner than the first Python version released 5 years after the release of Python 3.9.0.
596596
See details in:pep:`585`—*Type Hinting Generics In Standard Collections*.
597597

598598

@@ -1291,6 +1291,8 @@ These are not used in annotations. They are building blocks for creating generic
12911291
U = TypeVar('U', bound=str|bytes) # Can be any subtype of the union str|bytes
12921292
V = TypeVar('V', bound=SupportsAbs) # Can be anything with an __abs__ method
12931293

1294+
.. _typing-constrained-typevar:
1295+
12941296
Using a *constrained* type variable, however, means that the ``TypeVar``
12951297
can only ever be solved as being exactly one of the constraints given::
12961298

@@ -1550,7 +1552,7 @@ These are not used in annotations. They are building blocks for creating generic
15501552

15511553
..data::AnyStr
15521554

1553-
``AnyStr`` is a:class:`constrained type variable <TypeVar>` defined as
1555+
``AnyStr`` is a:ref:`constrained type variable<typing-constrained-typevar>` defined as
15541556
``AnyStr = TypeVar('AnyStr', str, bytes)``.
15551557

15561558
It is meant to be used for functions that may accept any kind of string
@@ -2112,7 +2114,7 @@ Other concrete types
21122114
Python 2 is no longer supported, and most type checkers also no longer
21132115
support type checking Python 2 code. Removal of the alias is not
21142116
currently planned, but users are encouraged to use
2115-
:class:`str` instead of ``Text`` wherever possible.
2117+
:class:`str` instead of ``Text``.
21162118

21172119
Abstract Base Classes
21182120
---------------------

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp