diff options
author | Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> | 2021-04-04 15:14:44 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-04 15:14:44 (GMT) |
commit | 2b5913b4ee5852a28ca1509478f5582beb3aff7b (patch) | |
tree | 7a33f0278fe1a26b84bed2555033212ea98a614c /Doc | |
parent | aadd4e10fda87b64ea527667238503da326a06e7 (diff) | |
download | cpython-2b5913b4ee5852a28ca1509478f5582beb3aff7b.zip cpython-2b5913b4ee5852a28ca1509478f5582beb3aff7b.tar.gz cpython-2b5913b4ee5852a28ca1509478f5582beb3aff7b.tar.bz2 |
bpo-41370: Add note about ForwardRefs and PEP585 generic types in docs (#25183)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/typing.rst | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 9696fd4..f6d1ccb 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -1948,10 +1948,15 @@ Introspection helpers .. class:: ForwardRef A class used for internal typing representation of string forward references. - For example, ``list["SomeClass"]`` is implicitly transformed into - ``list[ForwardRef("SomeClass")]``. This class should not be instantiated by + For example, ``List["SomeClass"]`` is implicitly transformed into + ``List[ForwardRef("SomeClass")]``. This class should not be instantiated by a user, but may be used by introspection tools. + .. note:: + :pep:`585` generic types such as ``list["SomeClass"]`` will not be + implicitly transformed into ``list[ForwardRef("SomeClass")]`` and thus + will not automatically resolve to ``list[SomeClass]``. + .. versionadded:: 3.7.4 Constant |