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

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Apr 21 02:18:41 CEST 2010


Paul Moore wrote:

> As Mike Meyer explained, whether file foo.C "has extension .c" depends
> (as far as the user is concerned) on whether the filesystem it's on is
> case sensitive.

I don't think that's really true. It's common to find,
e.g., files ending with .jpg, .JPG, or other variations on
a case-sensitive filesystem that got there by being copied
from a case-insensitive one, or simply created by people
using tools that don't care about the case of the extension.

Seems to me the best thing to do is always compare extensions
case-insensitively unless you have a specific reason to do
otherwise. So I would recommend that any proposed hasextension()
function should be case-insensitive by default.

-- 
Greg



More information about the Python-ideas mailing list