[issue10518] Bring back callable()

Ezio Melotti report at bugs.python.org
Wed Nov 24 21:35:13 CET 2010


Ezio Melotti <ezio.melotti at gmail.com> added the comment:

I'm not sure it's worth bringing callable() back at this point.
It would have made more sense for 3.1, but now we already have 2  callable()-less versions of Python if we do it for 3.2 (what about the moratorium though?) or 3 if we do it for 3.3.  Also if isinstance(obj, collections.Callable) is correct in what it does, it's trivial to do something like:

def callable(obj):
  return isinstance(obj, collections.Callable)


If it goes in the `iscallable` name suggested on python-dev might be better (IMHO).  At least people will realize that it's something "new" and don't assume that the old callable() has been there all the time (it also clear that it returns a boolean and reads better in e.g. `if iscallable(obj): ...`).
(The patch should also include an entry in the table at the top of functions.rst now that I committed #10299 in r86732.)

----------
nosy: +ezio.melotti

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10518>
_______________________________________


More information about the Python-bugs-list mailing list