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

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Apr 23 02:33:10 CEST 2010


Mike Meyer wrote:
> 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".

But you don't know whether the user is expecting this. If he
knows that gcc distinguishes between .c and .C, it may be that
he is expecting foo to be compiled as a C file rather than C++,
and he made a mistake when he named the file foo.C.

-- 
Greg




More information about the Python-ideas mailing list