]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-41370: Add note about ForwardRefs and PEP585 generic types in docs (#25183)
authorKen Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Sun, 4 Apr 2021 15:14:44 +0000 (23:14 +0800)
committerGitHub <noreply@github.com>
Sun, 4 Apr 2021 15:14:44 +0000 (08:14 -0700)
Doc/library/typing.rst

index 9696fd4ef99e6abf3e36e6dbd411e8a7f3c48c10..f6d1ccb1c5b3d8f81111cd6cea9b274707312481 100644 (file)
@@ -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