[Python-Dev] splitext('.cshrc') (original) (raw)
Alexey Borzenkov snaury at gmail.com
Thu Mar 8 18:36:18 CET 2007
- Previous message: [Python-Dev] splitext('.cshrc')
- Next message: [Python-Dev] splitext('.cshrc')
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 3/7/07, Josiah Carlson <jcarlson at uci.edu> wrote:
"Martin v. Löwis" <martin at v.loewis.de> wrote: > Now it's becoming difficult: several people in favor, some opposed... What about changing the semantics of splitext and creating a new function (available on all platforms) that does what the Windows version currently does?
I don't understand only one thing, why do people need new functions? You can anticipate the change today, and write functions that do exactly what you need no matter which way (current or proposed) python implements:
def ensurenew(path): a,b = os.path.splitext(path) if a == '': # also possibly check if a contains dots only return b,a return a,b
def ensureold(path): a,b = os.path.splitext(path) if b == '' and a.startswith('.'): # also possibly check if a starts with multiple dots return b,a return a,b
Best regards, Alexey.
- Previous message: [Python-Dev] splitext('.cshrc')
- Next message: [Python-Dev] splitext('.cshrc')
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]