File creation, polluted name space?

Christopher A. Craig list-python at
Wed Feb 18 18:51:37 CET 2004

"Derek Rhodes" <rhoder at> writes:

> after I < from import os * > I can't seem to create a file
> by the method shown above.

Then don't from os import * :-)

The "from spam import *" construct is known to be susceptible to all
kinds of name space collisions and its use is generally discouraged.

Unless you _really_ know what you're doing and have a _really_ good
reason, either use "import spam" or "from spam import ham,eggs".  If
you have a really good reason, you may want to rethink it anyway.

Christopher A. Craig <list-python at>
"Unix-to-Unix Copy Program," said PDP-1. "You will never find a more
wretched hive of bugs and flamers. We must be cautious." - DEC Wars

More information about the Python-list mailing list