Message416958
I tried out 3.11 on my pyanalyze type checker and got some failures because of this change, because my previous trick for distinguishing between Tuple and Tuple[()] failed.
3.10:
>>> from typing import get_args, Tuple
>>> get_args(Tuple[()])
((),)
>>> get_args(Tuple)
()
3.11:
>>> from typing import get_args, Tuple
>>> get_args(Tuple[()])
()
>>> get_args(Tuple)
()
However, the new behavior is more consistent: get_args(tuple[()]) always returned (). It's also easy enough to work around (just check `... is Tuple`).
I'll put a note in the What's New for 3.11 about this change. |
|
Date |
User |
Action |
Args |
2022-04-08 05:07:15 | JelleZijlstra | set | recipients:
+ JelleZijlstra, gvanrossum, serhiy.storchaka, kj |
2022-04-08 05:07:15 | JelleZijlstra | set | messageid: <1649394435.24.0.500089036679.issue46981@roundup.psfhosted.org> |
2022-04-08 05:07:15 | JelleZijlstra | link | issue46981 messages |
2022-04-08 05:07:15 | JelleZijlstra | create | |
|