Callable assertion?
Roy Smith
roy at panix.com
Sun Oct 5 10:20:11 EDT 2003
In article <wMOdnYxfQN0hux2iRTvUqg at speakeasy.net>,
"A.M. Kuchling" <amk at amk.ca> wrote:
> On Sun, 05 Oct 2003 08:55:45 -0400,
> Roy Smith <roy at panix.com> wrote:
> > the right thing to do, or is there something cleaner? Will that work
> > for all callable values of param, regardless if it's a static function,
> > class method, built-in, etc?
>
> There's a callable(param) built-in function, dating back to Python 1.2.
>
> --amk
Ah. That's exactly what I was looking for! The docs say:
"Return true if the object argument appears callable, false if not. If
this returns true, it is still possible that a call fails, but if it is
false, calling object will never succeed."
What does "appears callable" mean? Under what circumstances would
callable(foo) return True, yet foo() would fail?
More information about the Python-list
mailing list