From df9abfd9be4852caeacf97d2e51fbe8a0da44ac2 Mon Sep 17 00:00:00 2001 From: David Foster Date: Mon, 8 Dec 2025 07:38:02 -0500 Subject: [PATCH] PEP 747: Clarify that TypeForm(T) is always a TypeForm[T] --- peps/pep-0747.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/peps/pep-0747.rst b/peps/pep-0747.rst index 06a16262432..5ba1ed95ee5 100644 --- a/peps/pep-0747.rst +++ b/peps/pep-0747.rst @@ -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