[SciPy-dev] Re: Bug in scipy import
answer at tnoo.net
Tue Oct 5 12:52:35 CDT 2004
Thanks for your explanation.
Travis Oliphant <oliphant at ee.byu.edu> writes:
> >import scipy
> >imports and executes any file named "new.py" in the current working
> I think this 'bug' will happen anytime you name a file using a Python module
> name that another module is expecting. Your new.py file is over-riding the
> Python module new here that parts of scipy depends on.
> Try naming a file re.py in your current directory and you will get similar
> problems. -Travis
So whether a given library works depends on the file names that one has in a
random directory. Hmmm. This is a nasty behavior, and I'm glad I never run
this before. To me this looks like a design flaw if the module names from the
standard library are not __somehow__ protected.
I'll have to ponder about PYTHON_PATH, but this whole business seems to be
quite fragile. As little as I like Java, the module naming scheme is the one
thing that they got right. Time for a PEP?
Martin Lüthi answer at tnoo.net
More information about the Scipy-dev