How to check if the instances of a given class are callable? This is easy to do if you instantiate the class and then use callable(). But my question is how to check this without instantiating. Take for example the Calendar class:
>>> import calendar
>>> callable(calendar.Calendar())
False
I want to do the same but without instantiating, i.e. implement some function callable_class_instances() such that:
>>> import calendar
>>> callable_class_instances(calendar.Calendar)
False
>>>
>>> class MyFunc:
... def __init__(self):
... print('Should not run on callable_class_instances call.')
... def __call__(self):
... print('MyFunc instance called.')
>>> callable_class_instances(MyFunc)
True
Is there any simple way to do this which does not look like a hack?