Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion peps/pep-0747.rst
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,13 @@ Type checkers should validate that this argument is a valid type expression::
x1 = TypeForm(str | None)
reveal_type(v1) # Revealed type is "TypeForm[str | None]"

x2 = TypeForm("list[int]")
x2 = TypeForm('list[int]')
revealed_type(v2) # Revealed type is "TypeForm[list[int]]"

x3 = TypeForm('type(1)') # Error: invalid type expression

The static type of a ``TypeForm(T)`` is ``TypeForm[T]``.

At runtime the ``TypeForm(...)`` callable simply returns the value passed to it.

This explicit syntax serves two purposes. First, it documents the developer's
Expand Down