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 kj
Recipients JelleZijlstra, gvanrossum, kj, levkivskyi
Date 2021-06-22.13:29:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1624368599.83.0.338910210763.issue44490@roundup.psfhosted.org>
In-reply-to
Content
Recently I noticed that the new PEP 604 Union type doesn't collect type variables:

from typing import TypeVar
T = TypeVar('T')

(int | list[T]).__parameters__

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'types.Union' object has no attribute '__parameters__'

Whereas the typing.Union version has __parameters__. Is this behavior intentional?

The downside to this is that things like this don't work:

alias: TypeAlias = int | list[T]
alias[str] # Error!
History
Date User Action Args
2021-06-22 13:29:59kjsetrecipients: + kj, gvanrossum, levkivskyi, JelleZijlstra
2021-06-22 13:29:59kjsetmessageid: <1624368599.83.0.338910210763.issue44490@roundup.psfhosted.org>
2021-06-22 13:29:59kjlinkissue44490 messages
2021-06-22 13:29:59kjcreate