[Python-Dev] Proposal to revert r54204 (splitext change)

Phillip J. Eby pje at telecommunity.com
Tue Mar 20 15:54:35 CET 2007


At 09:24 AM 3/20/2007 +0100, Ronald Oussoren wrote:
>I don't agree. "all_ext=True" is won't do the right thing in a
>significant subset of filenames

Yes, that's understood.  The problem is that splitext() in general "won't 
do the right thing", for many definitions of "the right thing", unless 
you're applying it to a fairly constrained range of filenames, or unless 
you add other code.  This won't change, unless we get rid of splitext() 
altogether.

If you're trying to match an archive extension, for example, you'll 
probably need to loop on repeated splitext() calls until you find an 
extension that matches.  One benefit of using both the new keyword 
arguments together is that it allows you to make your loop proceed from 
longest match to shortest, so that if you are matching 
product-X.Y.Z.tar.gz, you're going to go through matching .Y.Z.tar.gz, then 
.Z.tar.gz, then .tar.gz.


>The ignore_leading_dot argument also doesn't buy you anything that can't
>trivially be implemented in other ways.

I don't understand.  Example?



More information about the Python-Dev mailing list