[ python-Bugs-1115886 ] os.path.splitext don't handle unix hidden file correctly
SourceForge.net
noreply at sourceforge.net
Sat Jun 18 23:05:42 CEST 2005
Bugs item #1115886, was opened at 2005-02-04 02:27
Message generated for change (Comment added) made by birkenfeld
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: Open
Resolution: None
Priority: 5
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: Reinhold Birkenfeld (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
More information about the Python-bugs-list
mailing list