Message146326
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__) |
|
Date |
User |
Action |
Args |
2011-10-24 21:44:58 | vstinner | set | recipients:
+ vstinner, pitrou, eric.araujo, flox |
2011-10-24 21:44:58 | vstinner | set | messageid: <1319492698.23.0.640994259296.issue13258@psf.upfronthosting.co.za> |
2011-10-24 21:44:57 | vstinner | link | issue13258 messages |
2011-10-24 21:44:57 | vstinner | create | |
|