Skip to content

Commit 74e861f

Browse files
authored
PEP 747: Clarify that TypeForm(T) is always a TypeForm[T] (#4736)
1 parent b1a156a commit 74e861f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

peps/pep-0747.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,11 +289,13 @@ Type checkers should validate that this argument is a valid type expression::
289289
x1 = TypeForm(str | None)
290290
reveal_type(v1) # Revealed type is "TypeForm[str | None]"
291291

292-
x2 = TypeForm("list[int]")
292+
x2 = TypeForm('list[int]')
293293
revealed_type(v2) # Revealed type is "TypeForm[list[int]]"
294294

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

297+
The static type of a ``TypeForm(T)`` is ``TypeForm[T]``.
298+
297299
At runtime the ``TypeForm(...)`` callable simply returns the value passed to it.
298300

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

0 commit comments

Comments
 (0)