[Python-Dev] os.path.normcase rationale?
p.f.moore at gmail.com
Fri Sep 24 16:53:56 CEST 2010
On 24 September 2010 15:29, Guido van Rossum <guido at python.org> wrote:
> I don't think we should try to reimplement what the filesystem does. I
> think we should just ask the filesystem (how exactly I haven't figured
> out yet but I expect it will be more OS-specific than
> filesystem-specific). It will have to be a new API -- normcase() at
> least is *intended* to return a case-flattened name on OSes where
> case-preserving filesystems are the default, and changing it to look
> at the filesystem would break too much code. For a new use case we
> need a new API.
I dug into this once, and as far as I could tell, it's possible to get
the information on Windows, but there's no way on Linux to "ask the
filesystem". From my researches, the standard interfaces a filesystem
has to implement on Linux don't offer any means of asking this
Of course, (a) I'm no Linux expert so what do I know, and (b) it may
well be possible to come up with a "good enough" solution by ignoring
pathologically annoying theoretical cases.
I'm happy to provide Windows code if someone needs it.
PS There were some places I'd have been glad of this feature (and from
what I recall, Mercurial could have used it too) so I'm +1 on the
More information about the Python-Dev