Message415557
I am for consistent behavior. If return GenericAlias(GenericAlias(tuple, Unpack[Ts]), (int, str)) for tuple[*Ts][int, str], we should also return GenericAlias(GenericAlias(list, T), int) for list[T][int], etc. And it will cause multiple problems:
* A repr can be less readable.
* It will break equality comparison and hashing. Good bye caching.
* What about __origin__, __parameters__, __args__? How will they be calculated?
* It can break code which uses annotations for something. For example it can break dataclasses.
It may be that will need to use it as a fallback for cases like tuple[T, *Ts][*Ts2] (currently it is error). But I am not sure that such cases should be supported. |
|
Date |
User |
Action |
Args |
2022-03-19 15:32:54 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, gvanrossum, JelleZijlstra, kj, matthew.rahtz, mrahtz, AlexWaygood |
2022-03-19 15:32:54 | serhiy.storchaka | set | messageid: <1647703974.17.0.900680651016.issue47006@roundup.psfhosted.org> |
2022-03-19 15:32:54 | serhiy.storchaka | link | issue47006 messages |
2022-03-19 15:32:54 | serhiy.storchaka | create | |
|