Skip to content

Commit

Permalink
Incorporated PR feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
erictraut committed Sep 15, 2024
1 parent b8b05f4 commit 0db7825
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion peps/pep-0747.rst
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,13 @@ For example, if a static type checker encounters the expression ``str | None``,
it may normally evaluate its type as ``UnionType`` because it produces a
runtime value that is an instance of ``types.UnionType``. However, because
this expression is a valid type expression, it is also assignable to the
type ``TypeForm[str | None]``.
type ``TypeForm[str | None]``:

v1_actual: UnionType = str | None # OK
v1_type_form: TypeForm[str | None] = str | None # OK

v2_actual: type = list[int] # OK
v2_type_form: TypeForm = list[int] # OK

The ``Annotated`` special form is allowed in type expressions, so it can
also appear in an expression that is assignable to ``TypeForm``. Consistent
Expand Down

0 comments on commit 0db7825

Please sign in to comment.