Bugs item #1115886, was opened at 2005-02-04 02:27
Message generated for change (Comment added) made by loewis
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1115886&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Jeong-Min Lee (falsetru)
Assigned to: Nobody/Anonymous (nobody)
Summary: os.path.splitext don't handle unix hidden file correctly
Initial Comment:
I expected this.
>>> os.path.splitext('/path/to/.Hiddenfile')
('/path/to/.Hiddenfile', '')
but got this.
>>> os.path.splitext('/path/to/.Hiddenfile')
('/path/to/', '.Hiddenfile')
----------------------------------------------------------------------
>Comment By: Martin v. Löwis (loewis)
Date: 2007-03-07 12:05
Message:
Logged In: YES
user_id=21627
Originator: NO
After some discussion on python-dev, I fixed this in r54204.
----------------------------------------------------------------------
Comment By: Jim Jewett (jimjjewett)
Date: 2007-03-07 00:20
Message:
Logged In: YES
user_id=764593
Originator: NO
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.
----------------------------------------------------------------------
Comment By: John J Lee (jjlee)
Date: 2005-12-04 15:44
Message:
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.
----------------------------------------------------------------------
Comment By: Georg Brandl (birkenfeld)
Date: 2005-06-18 23:05
Message:
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).
----------------------------------------------------------------------
Comment By: engelbert gruber (grubert)
Date: 2005-06-13 16:12
Message:
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
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1115886&group_id=5470
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com