8000 bpo-41370: Add note about ForwardRefs and PEP585 generic types in doc… · python/cpython@2b5913b · GitHub
[go: up one dir, main page]

Skip to content

Commit 2b5913b

Browse files
bpo-41370: Add note about ForwardRefs and PEP585 generic types in docs (#25183)
1 parent aadd4e1 commit 2b5913b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Doc/library/typing.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,10 +1948,15 @@ Introspection helpers
19481948
.. class:: ForwardRef
19491949

19501950
A class used for internal typing representation of string forward references.
1951-
For example, ``list["SomeClass"]`` is implicitly transformed into
1952-
``list[ForwardRef("SomeClass")]``. This class should not be instantiated by
1951+
For example, ``List["SomeClass"]`` is implicitly transformed into
1952+
``List[ForwardRef("SomeClass")]``. This class should not be instantiated by
19531953
a user, but may be used by introspection tools.
19541954

1955+
.. note::
1956+
:pep:`585` generic types such as ``list["SomeClass"]`` will not be
1957+
implicitly transformed into ``list[ForwardRef("SomeClass")]`` and thus
1958+
will not automatically resolve to ``list[SomeClass]``.
1959+
19551960
.. versionadded:: 3.7.4
19561961

19571962
Constant

0 commit comments

Comments
 (0)
0