[Python-Dev] Case sensitive import.
Steven D. Majewski
sdm7g@virginia.edu
Fri, 2 Feb 2001 12:46:23 -0500 (EST)
On Fri, 2 Feb 2001, Jeremy Hylton wrote:
>
> Our plan is to remove all of these modules and move the constants they
> define into the modules that provide the interface. Fred has already
> removed SOCKET, since all the constants are defined in socket. I
> don't think we'll get to the others in time for 2.1a2.
>
> Guido is strongly opposed to continuing after check_case returns
> false. His explanation is that imports ought to work whether all the
> there are multiple directories on sys.path or all the files are copied
> into a single directory. Obviously on file systems like HFS+, it
> would be impossible to have FCNTL.py and fcntl.py be in the same
> directory.
This is in my previous message to the list, but since there seems to
be (from my end, anyway) a long delay in list propagation, I'll repeat
to you, Jeremy:
The other problem is that without a patch, you can crash python
with a mis-cased typo, as it tries to import the same module
under two names:
>>> import cStringIO
>>> import cstringio
dyld: python2.0 multiple definitions of symbol _initcStringIO
/usr/local/lib/python2.0/lib-dynload/cStringIO.so definition of
_initcStringIO
/usr/local/lib/python2.0/lib-dynload/cstringio.so definition of
_initcStringIO
[ crash and burn back to shell prompt... ]
instead of (with patch):
>>> import cstringio
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: No module named cstringio
>>>
A .py module doesn't crash like a .so module, but it still yields
two (or more) different modules for each case spelling, which
could be the source of some pretty hard to find bugs when
MyModule.val != mymodule.val. ( Which is a more innocent mistake
than the person who actually writes two different files for
MyModule.py and mymodule.py ! )
---| Steven D. Majewski (804-982-0831) <sdm7g@Virginia.EDU> |---
---| Department of Molecular Physiology and Biological Physics |---
---| University of Virginia Health Sciences Center |---
---| P.O. Box 10011 Charlottesville, VA 22906-0011 |---
"All operating systems want to be unix,
All programming languages want to be lisp."