Hello. I’m the author of a library that uses runtime type introspection (cattrs, mentioned in the thread already). I can provide my perspective.
I really like the new type aliases because they’re distinct from their base types at runtime. The ability to treat an type Iso8601 = datetime
runtime alias to datetime.datetime
, or a Float32
runtime alias to float
is really valuable for certain types of libraries.
That said, I’m not sure how much of a problem it’d be for cattrs to enable most, if not all of the uses mentioned by @MegaIng as long as there’s a way to introspect the type and determine that it is, in fact, a type alias. (In older Pythons and typing.TypeAlias
this isn’t possible because they’re literally the same object.) It would also be great if functools.singledispatch
were made to work with type aliases treating them as a subtype, and not the exact type.
I think it’d be weird if Float32 is float
returned true though.