[Python-ideas] Small enhancement to os.path.splitext

Mike Meyer mwm-keyword-python.b4bdba at mired.org
Thu Apr 22 17:02:35 CEST 2010


On Thu, 22 Apr 2010 11:09:53 +1200
Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:

> Mike Meyer wrote:
> 
> > I'm talking about the case where the developer knows he wants
> > case sensitivity. In that case, you have to know whether or not the
> > file system is case sensitive to know whether or not "file.c" would
> > get opened if the application tried to open "file.C".
> 
> What? I thought the use case we were talking about is
> where you have a filename and you want to make a guess
> about what kind of data it contains, based on the
> extension.

How are these different? If the user typed the filename "foo.c" and I
am trying to decide if it has the ".C" extension. If "foo.C" exists on
the disk and the user knows that "foo.c" and "foo.C" are the same
file, it's reasonable for the user to expect the application to figure
out that this file has the ".C" extension, even though they typed
".c". So whether or not the comparison should be case sensitive
depends on whether or not the file system is case sensitive.

Likewise, if we're *saving* the file, and the user expects us to
automatically add the right extension, then if the file system is case
sensitive, ".c" is the wrong extension. If the file system is case
insensitive, it's not clear to me what the user might expect.

       <mike
-- 
Mike Meyer <mwm at mired.org>		http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org



More information about the Python-ideas mailing list