[Python-Dev] os.path.normcase rationale?

Ned Batchelder ned at nedbatchelder.com
Fri Sep 24 13:58:21 CEST 2010


  On 9/24/2010 6:13 AM, Chris Withers wrote:
> On 18/09/2010 23:36, Guido van Rossum wrote:
>> course, exists() and isdir() etc. do, and so does realpath(), but the
>> pure parsing functions don't.
>
> Yes, but:
>
> H:\>echo foo > TeSt.txt
> ...>>> import os.path
> >>> os.path.realpath('test.txt')
> 'H:\\test.txt'
> >>> os.path.normcase('TeSt.txt')
> 'test.txt'
>
> Both feel unsatisfying to me :-S
>
> How can I get 'TeSt.txt' from 'test.txt' (which feels like the 
> contract normcase *should* have...)
>
http://stackoverflow.com/questions/3692261/in-python-how-can-i-get-the-correctly-cased-path-for-a-file
>> They can be used without a working
>> filesystem even. (E.g. you can import ntpath on a Unix box and happily
>> parse Windows paths.)
>
> But what value does that add over just doing a .lower() on the path?
>
> Chris
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: 
> http://mail.python.org/mailman/options/python-dev/ned%40nedbatchelder.com
>


More information about the Python-Dev mailing list