Newbie: opening files.

Thomas Wouters thomas at xs4all.net
Fri May 19 23:27:45 CEST 2000


On Fri, May 19, 2000 at 10:44:54AM -1000, Doug Stanfield wrote:
> [First Bart Holthuijsen wrote:]
> > 
> > > from sys import *
> > > from os import *
> 
> [Then Moshe Zadka replied:]
> >                  ^^^^
> > Here's the culprit. The "os" module defines an "open" function. Don't
> > import "*". Ever.

> Unless you are at an interactive prompt, still the best way to explore
> module capabilities.  Can that be enforced somehow by the interpreter?:

Agreed that the interpreter is the best way to explore, however:

> >>> from os import *
> >>> dir()
> ['F_OK', 'O_APPEND', 'O_CREAT', 'O_EXCL', 'O_NDELAY', 'O_NOCTTY',
> 'O_NONBLOCK',
[..]

this is nonsense :-)

>>> import os
>>> dir(os)
['F_OK', 'O_APPEND', 'O_CREAT', 'O_DSYNC', 'O_EXCL', 'O_NDELAY', 'O_NOCTTY',
'O_NONBLOCK', 
[...]

Or did I miss your meaning ?

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list