Chris Mellon wrote: > On 11/29/06, Tom Plunket <[EMAIL PROTECTED]> wrote: >> 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? >> > >>>> def foo(): > ... pass > ... >>>> from inspect import isfunction >>>> isfunction(foo) > True >>>> > > > But you probably want the callable() builtin instead. >
This builtin will be removed in python 3.0! >> thanks, >> -tom! >> -- >> http://mail.python.org/mailman/listinfo/python-list >> -- http://mail.python.org/mailman/listinfo/python-list