[Python-ideas] PEP 428 - object-oriented filesystem paths

Antoine Pitrou solipsis at pitrou.net
Mon Oct 8 08:30:08 CEST 2012


On Mon, 08 Oct 2012 11:55:26 +1300
Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> 
> Not all that well, apparently. From the docs for os.path:
> 
> os.path.normcase(path)
>      Normalize the case of a pathname. On Unix and Mac OS X, this returns the
>      path unchanged; on case-insensitive filesystems, it converts the path to
>      lowercase. On Windows, it also converts forward slashes to backward slashes.
> 
> This is partially self-contradictory, since many MacOSX filesystems are
> actually case-insensitive; it depends on the particular filesystem concerned.
> Worse, different parts of the same path can have different case sensitivities.
> Also, with network file systems, not all paths are necessarily case-insensitive
> on Windows.

That's true, but considering paths case-insensitive under Windows and
case-sensitive under (non-OS X) Unix is still a very good approximation
that seems to satisfy most everyone.

> So there's really no certain way to compare pure paths for equality. Basing
> it on which OS is running your code is no more than a guess.

I wonder how well other file-dealing tools cope under OS X, especially
those that are portable and not OS X-specific.

Regards

Antoine.


-- 
Software development and contracting: http://pro.pitrou.net





More information about the Python-ideas mailing list