confusion about opening files

Chris Gonnerman chris.gonnerman at newcenturycomputers.net
Mon Sep 23 23:08:11 EDT 2002


----- Original Message ----- 
From: "robie1373" <robie at 1373.net>


> O. K. Now I am confused.  I thought that when I imported the 
> os module, i would have to call its functions like this: 
> os.open()    Why am I just using the function name?

os.open != open

open() is a builtin function, which "wraps" the C fopen() 
function (more or less), returning a file object implemented on 
top of stdio.h functions; os.open() "wraps" the C open() 
function, returning a file descriptor for the 
os.write()/os.read()/etc. functions.

If the function you WANTED was os.open, then you'd be right
about the behavior of imported modules.  However, what you want 
ISN'T os.open.

Chris Gonnerman -- chris.gonnerman at newcenturycomputers.net
http://newcenturycomputers.net





More information about the Python-list mailing list