[issue7006] The replacement suggested for callable(x) in py3k is not equivalent
Joe Amenta
report at bugs.python.org
Thu Dec 24 20:52:23 CET 2009
Joe Amenta <amentajo at msu.edu> added the comment:
One such weird corner case:
from collections import Callable
class Spam(object):
def __call__(self):
return self
can_of_spam = Spam()
print callable(can_of_spam) == isinstance(can_of_spam, Callable) # True
del Spam.__call__
can_of_spam.__call__ = lambda can: 'spam'
print callable(can_of_spam) == isinstance(can_of_spam, Callable) # False
Regardless, attached a patch for the new proposed semantics
----------
keywords: +patch
nosy: +joe.amenta
Added file: http://bugs.python.org/file15671/new_callable_semantics.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7006>
_______________________________________
More information about the Python-bugs-list
mailing list