Florent Xicluna <[email protected]> added the comment:
We have so many alternatives, it's funny ...
def callable(obj):
return hasattr(obj, '__call__') or hasattr(obj, '__bases__')
def callable(obj):
return isinstance(obj, collections.abc.Callable)
def callable(obj):
return hasattr(obj, '__call__') or type(obj) == types.ClassType
def callable(obj):
return any("__call__" in klass.__dict__
for klass in type(obj).__mro__)
----------
stage: -> patch review
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue13258>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com