bpo-41370: Add note about ForwardRefs and PEP585 generic types in docs (#25183)

This commit is contained in:
Ken Jin 2021-04-04 23:14:44 +08:00 committed by GitHub
parent aadd4e10fd
commit 2b5913b4ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View 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