Callable assertion?

Terry Reedy tjreedy at udel.edu
Sun Oct 5 12:18:43 EDT 2003


"Roy Smith" <roy at panix.com> wrote in message
news:roy-F9A420.08554505102003 at reader2.panix.com...
> I've got a function which gets passed a call-back function as a
> parameter.  I want to check to make sure the thing passed in is
indeed
> callable.

The acid test is to try calling it:

try: param()
except TypeError, msg: <do whatever>

You can check that msg.endswith('not callable') if you want but I
don't know the stability of the error message.

Terry J. Reedy








More information about the Python-list mailing list