Document typing.ForwardRef (GH-14216) · python/cpython@809ff11

Original file line numberDiff line numberDiff line change

@@ -1001,6 +1001,13 @@ The module defines the following classes, functions and decorators:

10011001
10021002

.. versionadded:: 3.8

10031003
1004+

.. class:: ForwardRef

1005+
1006+

A class used for internal typing representation of string forward references.

1007+

For example, ``List["SomeClass"]`` is implicitly transformed into

1008+

``List[ForwardRef("SomeClass")]``. This class should not be instantiated by

1009+

a user, but may be used by introspection tools.

1010+
10041011

.. function:: NewType(typ)

10051012
10061013

A helper function to indicate a distinct types to a typechecker,