[Python-checkins] [3.11] Minor improvements to typing docs (GH-104465) (#104475)

AlexWaygood webhook-mailer at python.org
Sun May 14 08:01:04 EDT 2023


https://github.com/python/cpython/commit/f5f99756e13cff0e98844e8e15a29519c25a04e5
commit: f5f99756e13cff0e98844e8e15a29519c25a04e5
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: AlexWaygood <Alex.Waygood at Gmail.com>
date: 2023-05-14T13:00:57+01:00
summary:

[3.11] Minor improvements to typing docs (GH-104465) (#104475)

Minor improvements to typing docs (GH-104465)
(cherry picked from commit 2f7b5e458e9189fa1ffd44339848aa1e52add3fa)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra at gmail.com>

files:
M Doc/library/typing.rst

diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst
index a99a35a7664f..443045469ad6 100644
--- a/Doc/library/typing.rst
+++ b/Doc/library/typing.rst
@@ -19,7 +19,7 @@
 
 This module provides runtime support for type hints. The most fundamental
 support consists of the types :data:`Any`, :data:`Union`, :data:`Callable`,
-:class:`TypeVar`, and :class:`Generic`. For a full specification, please see
+:class:`TypeVar`, and :class:`Generic`. For a specification, please see
 :pep:`484`. For a simplified introduction to type hints, see :pep:`483`.
 
 
@@ -587,7 +587,7 @@ The module defines the following classes, functions and decorators.
    when the checked program targets Python 3.9 or newer.
 
    The deprecated types will be removed from the :mod:`typing` module
-   in the first Python version released 5 years after the release of Python 3.9.0.
+   no sooner than the first Python version released 5 years after the release of Python 3.9.0.
    See details in :pep:`585`—*Type Hinting Generics In Standard Collections*.
 
 
@@ -1286,6 +1286,8 @@ These are not used in annotations. They are building blocks for creating generic
        U = TypeVar('U', bound=str|bytes)  # Can be any subtype of the union str|bytes
        V = TypeVar('V', bound=SupportsAbs)  # Can be anything with an __abs__ method
 
+.. _typing-constrained-typevar:
+
     Using a *constrained* type variable, however, means that the ``TypeVar``
     can only ever be solved as being exactly one of the constraints given::
 
@@ -1528,7 +1530,7 @@ These are not used in annotations. They are building blocks for creating generic
 
 .. data:: AnyStr
 
-   ``AnyStr`` is a :class:`constrained type variable <TypeVar>` defined as
+   ``AnyStr`` is a :ref:`constrained type variable <typing-constrained-typevar>` defined as
    ``AnyStr = TypeVar('AnyStr', str, bytes)``.
 
    It is meant to be used for functions that may accept any kind of string
@@ -2072,7 +2074,7 @@ Other concrete types
       Python 2 is no longer supported, and most type checkers also no longer
       support type checking Python 2 code. Removal of the alias is not
       currently planned, but users are encouraged to use
-      :class:`str` instead of ``Text`` wherever possible.
+      :class:`str` instead of ``Text``.
 
 Abstract Base Classes
 ---------------------



More information about the Python-checkins mailing list