Closes #13258: Use callable() built-in in the standard library.

This commit is contained in:
Florent Xicluna 2011-10-28 14:45:05 +02:00
parent f99e4b5dbe
commit 5d1155c08e
25 changed files with 48 additions and 51 deletions

View file

@ -134,7 +134,7 @@ def all_methods(obj):
temp = []
for name in dir(obj):
func = getattr(obj, name)
if hasattr(func, '__call__'):
if callable(func):
temp.append(name)
return temp
@ -510,7 +510,7 @@ class BaseManager(object):
'''
assert self._state.value == State.INITIAL
if initializer is not None and not hasattr(initializer, '__call__'):
if initializer is not None and not callable(initializer):
raise TypeError('initializer must be a callable')
# pipe over which we will retrieve address of server

View file

@ -151,7 +151,7 @@ class Pool(object):
if processes < 1:
raise ValueError("Number of processes must be at least 1")
if initializer is not None and not hasattr(initializer, '__call__'):
if initializer is not None and not callable(initializer):
raise TypeError('initializer must be a callable')
self._processes = processes