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

Peng Yu pengyu.ut at gmail.com
Tue Jun 22 11:42:50 EDT 2010


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)

$ ./main.py
False
False
True


>>>help(open)
Help on built-in function open in module __builtin__:

open(...)
    open(name[, mode[, buffering]]) -> file object

    Open a file using the file() type, returns a file object.  This is the
    preferred way to open a file.


-- 
Regards,
Peng



More information about the Python-list mailing list