[Python-ideas] Bring back callable()

Antoine Pitrou solipsis at pitrou.net
Wed Nov 24 00:20:24 CET 2010


On Tue, 23 Nov 2010 15:15:46 -0800
Alexandre Conrad
<alexandre.conrad at gmail.com> wrote:
> 2010/11/23 Antoine Pitrou <solipsis at pitrou.net>:
> > So, I would advocate bringing back the callable() builtin, which was
> > easy to use, helpful and semantically sane.
> 
> What about:
> 
> hasattr(obj, '__call__')

It's not the right code.
You can take a look at the implementation of Callable.__subclasshook__
here:
http://code.python.org/hg/branches/py3k/file/tip/Lib/_abcoll.py#l139

Regards

Antoine.





More information about the Python-ideas mailing list