[Python-Dev] Case sensitive import

Steven D. Majewski sdm7g@virginia.edu
Fri, 2 Feb 2001 12:18:40 -0500 (EST)


On Fri, 2 Feb 2001, Tim Peters wrote:

> I'd rather see the same rule used everywhere (keep going until finding an
> exact match), and tough beans to the person who writes
> 
>     import String
> 
> on Windows (or Mac) intending "string".  Windows probably still needs a
> unique wart to deal with case-destroying network filesystems, though.

I agree, and that's what my patch does for macosx.darwin  (or any unixy 
system that happens to have a filesystem with similar semantics -- if 
there is any such beast.) 

If the issues for windows are different (and it sounds like they are)
then I wanted to make sure (collectively) you were aware that this 
patch could be addressed independently, rather than waiting on a 
resolution of those other problems. 


> It's still terrible style to *rely* on case-sensitivity in file names, and
> all such crap should be purged from the Python distribution regardless.

I agree.
However, even if we purged all only-case-differing file names,
without a patch on macosx, you still can crash python with a
miscase typo, as it'll try to import the same module twice 
under a different name:

>>> 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


while with the patch, I get:  ImportError: No module named cstringio

---|  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."