[Python-ideas] filename comparison [was] Re: PEP 428 - object-oriented filesystem paths

Steven D'Aprano steve at pearwood.info
Tue Oct 16 08:43:52 CEST 2012


On Mon, Oct 15, 2012 at 04:21:50PM -0400, Jim Jewett wrote:

> 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".*

Well, perhaps you do, but those not using Windows are unlikely to care 
about DOS short names.

However, they may care about some other form of short name. E.g. on 
iso9660 file systems (CDs) long names are just truncated; if two 
truncated names clash, the second and subsequent file is given a three 
digit suffix:

this-is-a-long-file 
THIS-IS-A-LONG-NAME
My Documents

get renamed to:

THIS_IS_
THIS_000
MY_DOCUM

although my Linux computer displays those names in lower case. The Rock 
Ridge and Joliet extensions can record the unmangled file names, but not 
all CDs use them.

It is not the case that all case-insensitive file systems necessarily 
support DOS short names. There are file systems that don't support long 
names at all, there are case-insensitive file systems that preserve 
case, and those that don't.

It's not even necessarily so that Windows is always case-insensitive:

http://support.microsoft.com/kb/929110


-- 
Steven



More information about the Python-ideas mailing list