Message396329
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! |
|
Date |
User |
Action |
Args |
2021-06-22 13:29:59 | kj | set | recipients:
+ kj, gvanrossum, levkivskyi, JelleZijlstra |
2021-06-22 13:29:59 | kj | set | messageid: <1624368599.83.0.338910210763.issue44490@roundup.psfhosted.org> |
2021-06-22 13:29:59 | kj | link | issue44490 messages |
2021-06-22 13:29:59 | kj | create | |
|