[Python-3000] callable()

Fernando Perez fperez.net at gmail.com
Mon Jul 17 19:08:27 CEST 2006


Calvin Spealman wrote:

> I second that removal of callable() would be a bad idea. There are too
> many cases where it is not feasable to "just call the object and catch the
> exception". In the cases where the call would not happen until later than
> the test for callability, it would require then that any state changes
> caused before the call would be reversed if calling the object raised any
> error, and sometimes that is not even possible. Further, it ignores all
> cases where we are simply introspecting and do not want any side effects
> from said introspection.

 +1 on not removing callable().  Given how calling something has potentially
side effects, this is a good example of a situation where 'look before you
leap' is a safer approach, IMHO.  

IPython makes extensive use of callable() to provide some of its
command-line conveniences, and I don't see a clean way to replace it (short
of just adding back a private implementation of what callable does today by
copying out of a 2.x tree into ipython's).

Cheers,

f



More information about the Python-3000 mailing list