This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author hauntsaninja
Recipients hauntsaninja
Date 2020-10-20.21:48:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1603230529.81.0.174539582672.issue42102@roundup.psfhosted.org>
In-reply-to
Content
In the post PEP 585 world, it seems like a bit of a stumbling block for builtins.callable to not able to be parametrised (in a runtime context). Post PEP 604, I'd expect typing.Callable to be the most used typing import after typing.Any, so much of PEP 585's rationale should apply to this case too.

Concretely, one way to implement this would be to turn callable into a type whose __new__ returns a bool and which implements __class_getitem__. We could throw in an __instancecheck__ so that `isinstance(x, callable) == callable(x)`.


PS: Despite being code that crashes instantly, I was still able to find some instances of `isinstance(x, callable)` on popular Github projects: https://grep.app/search?q=isinstance%5C%28.%2A%2C%20callable%5C%29&regexp=true&case=true
History
Date User Action Args
2020-10-20 21:48:49hauntsaninjasetrecipients: + hauntsaninja
2020-10-20 21:48:49hauntsaninjasetmessageid: <1603230529.81.0.174539582672.issue42102@roundup.psfhosted.org>
2020-10-20 21:48:49hauntsaninjalinkissue42102 messages
2020-10-20 21:48:49hauntsaninjacreate