New submission from STINNER Victor <victor.stin...@haypocalc.com>: Python 2.7 emits a DeprecationWarning warning if callable() is called and python has the -3 option. callable() was removed in Python 3.0, but it was also added again in Python 3.2 (issue #10518).
$ ./python -bb -3 -Werror Python 2.7.2+ (2.7:7bfedb159e82, Jul 5 2011, 13:23:38) >>> callable(int) Traceback (most recent call last): File "<stdin>", line 1, in <module> DeprecationWarning: callable() not supported in 3.x; use isinstance(x, collections.Callable) I propose to drop the warning from Python 2.7. Use the six module if you would like to support Python 3.1, or use directly the following workaround in your code: def callable(obj): return any("__call__" in klass.__dict__ for klass in type(obj).__mro__) Attached patch removes the warning. By the way, the six should be updated for Python 3.2: callable is a builtin again ;-) ---------- files: callable_warning.patch keywords: patch messages: 139853 nosy: benjamin.peterson, haypo, pitrou priority: normal severity: normal status: open title: callable(): remove the deprecation warning from Python 2.7 versions: Python 2.7 Added file: http://bugs.python.org/file22581/callable_warning.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue12501> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com