Message379169
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®exp=true&case=true |
|
Date |
User |
Action |
Args |
2020-10-20 21:48:49 | hauntsaninja | set | recipients:
+ hauntsaninja |
2020-10-20 21:48:49 | hauntsaninja | set | messageid: <1603230529.81.0.174539582672.issue42102@roundup.psfhosted.org> |
2020-10-20 21:48:49 | hauntsaninja | link | issue42102 messages |
2020-10-20 21:48:49 | hauntsaninja | create | |
|