type(foo) == function ?
Tom Plunket
tomas at fancy.org
Wed Nov 29 15:17:46 EST 2006
I'd like to figure out if a given parameter is a function or not.
E.g.
>>> type(1)
<type 'int'>
>>> type(1) == int
True
implies:
>>> def foo():
... pass
...
>>> type(foo)
<type 'function'>
>>> type(foo) == function
Traceback (most recent call last):
File "<stdin>", line 1, in ?
NameError: name 'function' is not defined
Is there a way I can know if 'foo' is a function?
thanks,
-tom!
More information about the Python-list
mailing list