New submission from Zac Hatfield-Dodds <zac.hatfield.do...@gmail.com>:
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 ---------- components: Library (Lib) messages: 379869 nosy: Zac Hatfield-Dodds, gvanrossum, levkivskyi, serhiy.storchaka priority: normal severity: normal status: open title: Inconsistent __args__ between typing.Callable and collections.abc.Callable type: behavior versions: Python 3.10, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42195> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com