[Python-ideas] filename comparison [was] Re: PEP 428 - object-oriented filesystem paths
Jim Jewett
jimjjewett at gmail.com
Mon Oct 15 22:21:50 CEST 2012
On 10/8/12, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Ronald Oussoren wrote:
>> neither statvs, statvfs, nor pathconf seem to be able to tell if a
>> filesystem is case insensitive.
> Even if they could, you wouldn't be entirely out of the woods,
> because different parts of the same path can be on different
> file systems...
> But how important is all this anyway? I'm trying to think of
> occasions when I've wanted to compare two entire paths for
> equality, and I can't think of *any*.
I can think of several, but when I thought a bit harder, they were
mostly bug attractors.
If I want my program (or a dict) to know that "CONFIG" and "config"
are the same, then I also want it to know that "My Documents" is the
same as "MYDOCU~1".*
Ideally, I would also have a way to find out that a pathname is likely
to be problematic for cross-platform uses, or at least whether two
specific pathnames are known to be collision-prone on existing
platforms other than mine. (But I'm not sure that sort of test can be
reliable enough for the stdlib. Would just check for caseless
equality, reserved Windows names, and non-alphanumeric characters in
the filename?)
*(Well, assuming it is. The short name depends on the history of the
directory.)
-jJ
More information about the Python-ideas
mailing list