STINNER Victor <[email protected]> added the comment:
callable() is not just faster, it's also "more correct": hasattr(obj,
"__call__") doesn't call base classes. See callable() of the six module:
def callable(obj):
return any("__call__" in klass.__dict__ for klass in type(obj).__mro__)
----------
nosy: +haypo
_______________________________________
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