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

Terry Reedy tjreedy at udel.edu
Fri Mar 16 21:02:31 CET 2007

"Nick Coghlan" <ncoghlan at gmail.com> wrote in message 
news:45FAC92D.3090307 at gmail.com...
That may actually be a genuinely useful approach:

splitext(name, ignore_leading_dot=False, all_ext=False)

   Split the extension from a pathname. Returns "(root, ext)".
   By default, the extension is all characters from the last dot to the
end of the string. "ext" will be empty if there are no dots in the name
and "root" will be empty if the characters starts with a single dot and
that is the only dot in the name.
   If ignore_leading_dot=True, then a leading dot is always considered
part of "root", and is ignored when determining the extension. "root"
will never be empty in this case.
   If all_ext=True, the extension is all characters from the first dot to
the end.

'first dot' => 'first non-ignored dot'
in case both options are true.

In the long run (in 3.0), I think ignore_leading_dot should default to True 
rather than False since I think that is what more people will want. 
However, I believe the 2-to-3 converter could remove 
'ignore_leading_dot=True' and insert 'ignore_leading_dot=False' as needed.

Terry Jan Reedy

More information about the Python-Dev mailing list