os.path.normcase rationale?

Ben Finney ben+python at benfinney.id.au
Wed Sep 15 23:12:16 CEST 2010

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

> I'm curious as to why, with a file called "Foo.txt"
> os.path.normcase('FoO.txt') will return "foo.txt" rather than
> "Foo.txt"?

What kind of answer are you looking for?

A direct answer would be: it does that because on case-insensitive
filesystems, it doesn't matter what the case is, so there's no need for
anything more complex than all lowercase.

> Yes, I know the behaviour is documented

The docstring is fairly poor, IMO. You might want to submit a bug report
to improve it.

> but I'm wondering if anyone can remember the rationale for that
> behaviour?

I can't speak to that. Does the above answer seem sufficient?

 \         “I think there is a world market for maybe five computers.” |
  `\                             —Thomas Watson, chairman of IBM, 1943 |
_o__)                                                                  |
Ben Finney

More information about the Python-list mailing list