Message403594
> If you meant to say: why is typing.Union[] allowed, but not
types.UnionType[]? That is intentional. types.UnionType is only meant for
builtin types. Once you union with *any* type from typing, it will convert
to a typing.Union.
But why? Just so types.UnionType (if it has a typevar) doesn’t have to
support subscriptions? Even if this saves us now, I agree with OP that it
ought to allow it, so we can deprecate typing.Union properly. And e.g.
dict[str, T] works.
--
--Guido (mobile) |
|
Date |
User |
Action |
Args |
2021-10-10 15:16:50 | gvanrossum | set | recipients:
+ gvanrossum, serhiy.storchaka, joperez, kj |
2021-10-10 15:16:50 | gvanrossum | link | issue45418 messages |
2021-10-10 15:16:50 | gvanrossum | create | |
|