mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
replace callable()
This commit is contained in:
parent
0c8bee6393
commit
de0559998f
7 changed files with 18 additions and 18 deletions
|
@ -570,7 +570,7 @@ def _getmethods(obj, methods):
|
|||
# Adds names to dictionary argument 'methods'
|
||||
for name in dir(obj):
|
||||
attr = getattr(obj, name)
|
||||
if callable(attr):
|
||||
if hasattr(attr, '__call__'):
|
||||
methods[name] = 1
|
||||
if type(obj) == types.InstanceType:
|
||||
_getmethods(obj.__class__, methods)
|
||||
|
@ -581,7 +581,7 @@ def _getmethods(obj, methods):
|
|||
def _getattributes(obj, attributes):
|
||||
for name in dir(obj):
|
||||
attr = getattr(obj, name)
|
||||
if not callable(attr):
|
||||
if not hasattr(attr, '__call__'):
|
||||
attributes[name] = 1
|
||||
|
||||
class MethodProxy(object):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue