[Python-Dev] splitext('.cshrc')

Oleg Broytmann phd at phd.pp.ru
Tue Mar 6 16:19:29 CET 2007


On Tue, Mar 06, 2007 at 04:07:16PM +0100, "Martin v. L?wis" wrote:
> Oleg Broytmann schrieb:
> > On Tue, Mar 06, 2007 at 04:00:01PM +0100, "Martin v. L?wis" wrote:
> >>>    Yes. In .pythonrc.py .pythonrc is the root, and .py is the extension.
> >> Ah, it would do that already: with multiple dots, the last one always
> >> provides the extension.
> > 
> >    Ah, sorry. I messed it with .split().
> 
> Ok - now I'm confused: do you consider this behavior 
> (splitext('.pythonrc') == ('', '.pythonrc')) correct
> or not?

   I messed this in the sense that I have ran .split('.pythonrc.py'), got
('', '.pythonrc.py') and thought there is a problem. .split() works fine.
Even .splitext() works fine with multiple dots:

>>> os.path.splitext("/bin/.pythonrc.py")
('/bin/.pythonrc', '.py')

   but

>>> os.path.splitext(".pythonrc")
('', '.pythonrc')

   and I think it should be

('.pythonrc', '')

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.


More information about the Python-Dev mailing list