Why 'open' is not a function according to inspect module?

Mel mwilson at the-wire.com
Tue Jun 22 21:05:40 EDT 2010


Peng Yu wrote:

> Hi,
> 
> 'open' is not a function according to inspect module. But according to
> help(open), it is a function. Is there something wrong with inspect
> module?
> 
> $ cat main.py
> #!/usr/bin/env python
> 
> import inspect
> 
> def hello():
>   print "Hello World!"
>   return
> 
> print inspect.isfunction(str)
> print inspect.isfunction(open)
> print inspect.isfunction(hello)

help (inspect.isfunction) gives

Help on function isfunction in module inspect:

isfunction(object)
    Return true if the object is a user-defined function.


	Mel.






More information about the Python-list mailing list