From 17180c8b6152dbaa47c164277db015098b15698c Mon Sep 17 00:00:00 2001 From: Fidget-Spinner <28750310+Fidget-Spinner@users.noreply.github.com> Date: Sun, 4 Apr 2021 22:39:37 +0800 Subject: [PATCH 1/2] Add note about ForwardRefs and PEP585 generic types --- Doc/library/typing.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 9696fd4ef99e6a..391fa340249cc2 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 be resolved to ``list[SomeClass]``. + .. versionadded:: 3.7.4 Constant From 75a47e8da81b8be29f82629077a9225d445f5776 Mon Sep 17 00:00:00 2001 From: Fidget-Spinner <28750310+Fidget-Spinner@users.noreply.github.com> Date: Sun, 4 Apr 2021 22:42:31 +0800 Subject: [PATCH 2/2] slight wording tweaks --- Doc/library/typing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 391fa340249cc2..f6d1ccb1c5b3d8 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -1955,7 +1955,7 @@ Introspection helpers .. note:: :pep:`585` generic types such as ``list["SomeClass"]`` will not be implicitly transformed into ``list[ForwardRef("SomeClass")]`` and thus - will not be resolved to ``list[SomeClass]``. + will not automatically resolve to ``list[SomeClass]``. .. versionadded:: 3.7.4