This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gvanrossum
Recipients gvanrossum, joperez, kj, serhiy.storchaka
Date 2021-10-10.15:16:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAP7+vJKkOTeh=mEaPbOdC6smG+HOxmDpywVQU-egxP5fjKee1Q@mail.gmail.com>
In-reply-to <1633852223.45.0.0312685952185.issue45418@roundup.psfhosted.org>
Content
> 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)
History
Date User Action Args
2021-10-10 15:16:50gvanrossumsetrecipients: + gvanrossum, serhiy.storchaka, joperez, kj
2021-10-10 15:16:50gvanrossumlinkissue45418 messages
2021-10-10 15:16:50gvanrossumcreate