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 | |
parent | 64fdc268911058cf7408bf1534ca498b0b9b8b3b (diff) | |
download | six-91d80756e350a002cdfdba2254d4f35a806e7b65.tar.gz |
define callable to builtin callable when it's available on the latest py3 versions (fixes #17)
-rw-r--r-- | CHANGES | 3 | ||||
-rw-r--r-- | six.py | 10 |
2 files changed, 10 insertions, 3 deletions
@@ -6,6 +6,9 @@ This file lists the changes in each six version. Development version ------------------- +- Issue #17: Define callable to be builtin callable when it is available again + in Python 3.2+. + - Issue #16: Rename Python 2 exec_'s arguments, so casually calling exec_ with keyword arguments will raise. @@ -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 |