diff options
author | Benjamin Peterson <benjamin@python.org> | 2013-01-13 09:31:41 -0500 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2013-01-13 09:31:41 -0500 |
commit | 91d80756e350a002cdfdba2254d4f35a806e7b65 (patch) | |
tree | fad3c4decc2bc72c7ea1867d95e226d646a0a401 /six.py | |
parent | 64fdc268911058cf7408bf1534ca498b0b9b8b3b (diff) | |
download | six-91d80756e350a002cdfdba2254d4f35a806e7b65.tar.gz |
define callable to builtin callable when it's available on the latest py3 versions (fixes #17)
Diffstat (limited to 'six.py')
-rw-r--r-- | six.py | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -235,14 +235,18 @@ except NameError: next = advance_iterator +try: + callable = callable +except NameError: + def callable(obj): + return any("__call__" in klass.__dict__ for klass in type(obj).__mro__) + + if PY3: def get_unbound_function(unbound): return unbound Iterator = object - - def callable(obj): - return any("__call__" in klass.__dict__ for klass in type(obj).__mro__) else: def get_unbound_function(unbound): return unbound.im_func |