(Serious?) package namespace problem (and a proposal)
Huaiyu Zhu
hzhu at knowledgetrack.com
Wed Jun 28 19:30:33 EDT 2000
On Wed, 28 Jun 2000 22:42:33 GMT, Huaiyu Zhu <hzhu at knowledgetrack.com> wrote:
>To avoid any further unnecessary digressions, I state my actual problem
>here. I'm developing the MatPy pacakge which works quite well on Linux and
>Solaris, but some Windows user's keep complaining about name clashes. It
>turns out that I have, in the file MatPy/gnuplot.py, this line
>
>from Gnuplot import Gnuplot
>
>Since on Windows Gnuplot.py and gnuplot.py is indistinguishable, this line
>tries to import itself!
>
Let me describe this more precisely. Within $PYTHONPATH/MatPy/gnuplot.py,
the statement
import Gnuplot
will import $PYTHONPATH/Gnuplot/__init__.py on Unix, which is intended, but
$PYTHONPATH/MatPy/gnuplot.py on Windows, which causes havoc.
Now the simplest solution for this particular problem is just to rename
MatPy/gnuplot.py into something else. I am objecting to this on principle.
Because this essentially requires every module in every package to be
uniquely named (and case insensitive) from the beginning, as one is never
sure that in some future implementation one might not want to import a
module from a different package with an identical name.
I'm open to any solutions. Be there any doubt as to what the problem is,
you can test it on the MatPy package listed below as well.
--
Huaiyu Zhu hzhu at users.sourceforge.net
Matrix for Python Project http://MatPy.sourceforge.net
More information about the Python-list
mailing list