From 91d80756e350a002cdfdba2254d4f35a806e7b65 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Sun, 13 Jan 2013 09:31:41 -0500 Subject: define callable to builtin callable when it's available on the latest py3 versions (fixes #17) --- six.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'six.py') diff --git a/six.py b/six.py index 4fc0d2c..ab45e38 100644 --- a/six.py +++ b/six.py @@ -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 -- cgit v1.2.1