[Python-Dev] casefolding in pathlib (PEP 428)

Cameron Simpson cs at zip.com.au
Fri Apr 12 01:30:55 CEST 2013

On 11Apr2013 16:23, Guido van Rossum <guido at python.org> wrote:
| On Thu, Apr 11, 2013 at 4:09 PM, Cameron Simpson <cs at zip.com.au> wrote:
| > On 11Apr2013 14:11, Guido van Rossum <guido at python.org> wrote:
| > | Some of my Dropbox colleagues just drew my attention to the occurrence
| > | of case folding in pathlib.py. Basically, case folding as an approach
| > | to comparing pathnames is fatally flawed. [...]
| >
| > Yes, but what's the use case? Specificly, _why_ are you comparing pathnames?
| Um, this isn't about Dropbox. This is a warning against the inclusion
| of any behavior depending on case folding in pathlib, based on
| experience with case folding at Dropbox (both in the client and in the
| server).

Ah. That wasn't so apparent to me. I took you to have tripped over
a specific problem that pathlib appeared to be missolving.

I've always viewed path normalisation and its ilk as hazard prone
and very context dependent, so I tend not to do it if I can help

| You seem to be completely misunderstanding me. I am not asking for
| help solving our problem. I am giving advice to avoid baking the wrong
| solution to this class of problems into a new stdlib module.

Ok, fine.

[...snip lots of stuff now not relevant...]
| My reasoning is as follows. If pathlib supports functionality for
| checking whether two paths spelled differently point to the same file,
| users are going to rely on that functionality. But if the
| implementation is based on knowing how and when to case fold, it will
| definitely have bugs. So I am proposing to either remove that
| functionality, or to implement it by consulting the filesystem. Which
| of course has its own set of issues, for example if the file doesn't
| exist yet, but there are ways to deal with that too.

Personally I'd be for removing it, or making the doco quite blunt
about the many possible shortcomings of guessing whether two paths
are the same thing without being able to stat() them.

I'll back out now. Cheers,
Cameron Simpson <cs at zip.com.au>

Having been erased,
The document you're seeking
Must now be retyped.
- Haiku Error Messages http://www.salonmagazine.com/21st/chal/1998/02/10chal2.html

More information about the Python-Dev mailing list