Issue1115886
Created on 2005-02-04 01:27 by falsetru, last changed 2007-03-07 11:05 by loewis.
| Messages (6) | |||
|---|---|---|---|
| msg24149 - (view) | Author: Jeong-Min Lee (falsetru) | Date: 2005-02-04 01:27 | |
I expected this.
>>> os.path.splitext('/path/to/.Hiddenfile')
('/path/to/.Hiddenfile', '')
but got this.
>>> os.path.splitext('/path/to/.Hiddenfile')
('/path/to/', '.Hiddenfile')
|
|||
| msg24150 - (view) | Author: engelbert gruber (grubert) | Date: 2005-06-13 14:12 | |
Logged In: YES
user_id=147070
from test_posixpath.py ::
self.assertEqual(posixpath.splitext(".ext"), ("", ".ext"))
IMHO should then return (".ext",""). if this is desired ::
if i<=p.rfind('/'):
return p, ''
else:
return p[:i], p[i:]
should do
|
|||
| msg24151 - (view) | Author: Georg Brandl (georg.brandl) | Date: 2005-06-18 21:05 | |
Logged In: YES user_id=1188172 Interestingly, altering the behaviour of splitext in such a way does not contradict the documentation, which is: """ Split the pathname path into a pair (root, ext) such that root + ext == path, and ext is empty or begins with a period and contains at most one period. """ Personally I'm in favour of this change (on Unix it makes sense, while on Windows you can hardly find an "extension-only" file). |
|||
| msg24152 - (view) | Author: John J Lee (jjlee) | Date: 2005-12-04 14:44 | |
Logged In: YES
user_id=261020
-1
I hate to be a stick-in-the-mud, but the existing behaviour
is what I would expect, and seems to be regular -- always
picks the last dot:
>>> os.path.splitext('a/b/c/foo.bar')
('a/b/c/foo', '.bar')
>>> os.path.splitext('a/b/c/f.oo.bar')
('a/b/c/f.oo', '.bar')
>>> os.path.splitext('a/b/c/.foo')
('a/b/c/', '.foo')
>>> os.path.splitext('a/b/c/.foo.txt')
('a/b/c/.foo', '.txt')
Changing it would surely break somebody's code too, of course.
|
|||
| msg24153 - (view) | Author: Jim Jewett (jimjjewett) | Date: 2007-03-06 23:20 | |
1462106 is a patch, though perhaps not the latest. python-dev is currently debating whether to fix this behavior or maintain backwards-compatibility. That suggests that it at least won't be changed in a bugfix version (like 2.4.x), and the group should be changed to 2.6. |
|||
| msg24154 - (view) | Author: Martin v. Löwis (loewis) | Date: 2007-03-07 11:05 | |
After some discussion on python-dev, I fixed this in r54204. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2005-02-04 01:27:06 | falsetru | create | |