Ezio Melotti <ezio.melo...@gmail.com> added the comment: Benjamin already replaced hasattr(x, "__call__") with hasattr(type(x), "__call__") in the Python 3.0 "What's New" in r75090 and r75094, but this still doesn't match completely the behavior of callable():
>>> class Foo(object): pass ... >>> foo = Foo() >>> callable(foo) False >>> hasattr(type(foo), '__call__') True >>> foo() Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'Foo' object is not callable There are also other places where hasattr(x, "__call__") is still suggested/used (e.g. PEP3100). ---------- nosy: +benjamin.peterson _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue7006> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com