os.path.normcase rationale?

Ben Finney ben+python at benfinney.id.au
Mon Sep 20 20:12:27 EDT 2010


Chris Withers <chris at simplistix.co.uk> writes:

> What I expected it to mean was "give me what the filesystem thinks
> this file path is", which doesn't seem unreasonable and would be a lot
> more useful, no matter the platform...

Two problems with that.

One is that the entry specified by the path may not exist on the
filesystem, but the function shouldn't care about that. It's for
“normalising” a path, whether the entry referred to exists or not.

Another is that filesystems don't have a standard way of determining
whether they are case-sensitive. The operating system's driver for that
particular filesystem knows, but Python doesn't.

So in this case you'll simply have to adjust your expectations.

-- 
 \           “I prayed for twenty years but received no answer until I |
  `\          prayed with my legs.” —Frederick Douglass, escaped slave |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list