PEP 747: TypeExpr: Type Hint for a Type Expression

As one of the most common type forms I use in runtime context is Unions, I’d strongly prefer solution 2. UnionType I view as mostly an internal annotation currently and would rather update typeshed to use TypeForm where needed over saying that I can’t pass explicit Union[int, str] (or int | str) to function that will handle runtime types.

On naming I’m happy with TypeForm. I also liked TypeAnnotation which is a bit verbose, but pretty explicit.

2 Likes