Author Zac Hatfield-Dodds
Recipients Zac Hatfield-Dodds, gvanrossum, levkivskyi, serhiy.storchaka
Date 2020-10-29.12:25:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1603974319.88.0.166786801787.issue42195@roundup.psfhosted.org>
In-reply-to
Content
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
History
Date User Action Args
2020-10-29 12:25:19Zac Hatfield-Doddssetrecipients: + Zac Hatfield-Dodds, gvanrossum, serhiy.storchaka, levkivskyi
2020-10-29 12:25:19Zac Hatfield-Doddssetmessageid: <1603974319.88.0.166786801787.issue42195@roundup.psfhosted.org>
2020-10-29 12:25:19Zac Hatfield-Doddslinkissue42195 messages
2020-10-29 12:25:19Zac Hatfield-Doddscreate