[Python-ideas] Small enhancement to os.path.splitext

Fred Drake fdrake at acm.org
Tue Apr 20 19:07:15 CEST 2010


On Tue, Apr 20, 2010 at 12:47 PM, Tarek Ziadé <ziade.tarek at gmail.com> wrote:
> I am not sure to follow the issue. Do you mean that in the same filesystem,
> each directory can treat case sensivity differently ? I wasn't aware of that.

I've never seen a filesystem that doesn't treat case-sensitivity
consistently, regardless of path.

But a single hierarchy composed of multiple filesystems may have
different behaviors in different directories, because they're mounted
from different filesystems.

> How would this affect the extension btw ?   I can imagine that
> the path+extensions could to be normalized before the matching job, but
> I don't see other issue, do you have an example ?

I suspect a substantial part of the problem is really that Python
doesn't expose an API to normalize a path based on it's actual
location in the hierarchy; the operating system is used, but nothing
that deals with a path on a mounted filesystem that has non-default
behavior when compared to the traditional OS-centric expectations.

For a specific example, consider mounting a case-insensitive HFS
filesystem from Unix (well, most current Unixes): If the HFS is
mounted at /MyHfsMount (on an ext3 filesystem), and contains a
hierarchy /Folder/SomeFile.txt, the file would have an absolute path
of

    /MyHfsMount/Folder/SomeFile.txt

But the normalized path should be:

    /MyHfsMount/folder/somefile.txt

(Note that each path segment is normalized according to the filesystem
it's on, rather than the running OS.)


  -Fred

-- 
Fred L. Drake, Jr.    <fdrake at gmail.com>
"Chaos is the score upon which reality is written." --Henry Miller



More information about the Python-ideas mailing list