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

Andrew Bennetts andrew-pythondev at puzzling.org
Thu Mar 8 07:03:55 CET 2007

Josiah Carlson wrote:
> Offer a new splitext that uses X on posix and Y on win32, but causes a
> DeprecationWarning with pointers to the two renamed functions that are
> available on both platforms.
> For people who want the old platform-specific functionality in previous
> and subsequent Pythons, offer the ability to disable the
> DeprecationWarning via a module global; at least until the function is
> removed in some future Python, at which point path.splitext would cause
> an AttributeError .

It's not about cross-platform behaviour.  It's already the same:

>>> import posixpath, ntpath
>>> ntpath.splitext('.cshrc')
('', '.cshrc')
>>> posixpath.splitext('.cshrc')
('', '.cshrc')

And as I understand it, the current proposal would change this behaviour the
same way on win32 and POSIX, although I may not have kept up with that part of
the discussion enough.  Is there a genuine desire for this to behave differently
on different platforms?

I think what I'd probably like to see is the existing undefined (but
well-understood and predictable) behaviour to be declared defined, and a warning
put in the documentation that it probably doesn't do what you expect for this
case.  And then for those that want the new behaviour, provide a new function
(and prominently advertise it in the relevant part of the documentation).  Yes
it sucks having two similar functions, which will inevitably have similar names,
but that's the price you pay for getting the interface wrong the first time


More information about the Python-Dev mailing list