Newbie: opening files.

Doug Stanfield DOUGS at oceanic.com
Fri May 19 18:01:37 EDT 2000


I was only hoping to illustrate what the issue is.  You've probably helped,
but I'm still not sure what will make the "ahaaa" bomb go off for others.
Only remembering it took me a while. :-/  This is namespace pollution,
right?

-Doug-

> -----Original Message-----
> From: Thomas Wouters [mailto:thomas at xs4all.net]
> Sent: Friday, May 19, 2000 11:28 AM
> To: Doug Stanfield
> Cc: python-list at python.org
> Subject: Re: Newbie: opening files.
> 
> 
> 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!
> 
> -- 
> http://www.python.org/mailman/listinfo/python-list
> 




More information about the Python-list mailing list