Message146328
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__) |
|
Date |
User |
Action |
Args |
2011-10-24 22:18:39 | flox | set | recipients:
+ flox, pitrou, vstinner, eric.araujo |
2011-10-24 22:18:39 | flox | set | messageid: <1319494719.51.0.332026336599.issue13258@psf.upfronthosting.co.za> |
2011-10-24 22:18:38 | flox | link | issue13258 messages |
2011-10-24 22:18:38 | flox | create | |
|