Message379869
The two ways of getting a parametrised Callable have inconsistent __args__:
>>> import collections.abc, typing
>>> typing.Callable[[int, int], int].__args__
(int, int, int)
>>> collections.abc.Callable[[int, int], int].__args__
([int, int], int)
I discovered this while working on PEP 585 support in Hypothesis [1], where it is easy enough to work around but carries a potentially serious performance cost - the list means we cannot use the type as a cache key for non-`...` argument types.
https://bugs.python.org/issue40494 and https://bugs.python.org/issue40398 may be related.
[1] https://github.com/HypothesisWorks/hypothesis/pull/2653 |
|
Date |
User |
Action |
Args |
2020-10-29 12:25:19 | Zac Hatfield-Dodds | set | recipients:
+ Zac Hatfield-Dodds, gvanrossum, serhiy.storchaka, levkivskyi |
2020-10-29 12:25:19 | Zac Hatfield-Dodds | set | messageid: <1603974319.88.0.166786801787.issue42195@roundup.psfhosted.org> |
2020-10-29 12:25:19 | Zac Hatfield-Dodds | link | issue42195 messages |
2020-10-29 12:25:19 | Zac Hatfield-Dodds | create | |
|