Author ncoghlan
Recipients laxrulz777, loewis, ncoghlan, skip.montanaro
Date 2008-12-30.13:55:40
SpamBayes Score 1.3325e-08
Marked as misclassified No
Message-id <1230645342.3.0.0583669451709.issue4755@psf.upfronthosting.co.za>
In-reply-to
Content
1. The discussion on python-dev shows that the current documentation of
os.path.commonprefix is incorrect - it technically works element by
element rather than character by character (since it will handle
sequences other than strings, such as lists of path components)

2. Splitting on os.sep is not the correct way to break a string into
path components. Instead, os.path.split needs to be applied repeatedly
until "head" is a single character (a single occurrence of os.sep or
os.altsep for an absolute path) or empty (for a relative path).
(Alternatively, but with additional effects on the result, the
separators can be normalised first with os.path.normpath or
os.path.normcase)

  For Windows, os.path.splitunc and os.path.splitdrive should also be
invoked first, and if either returns a non-empty string, that should
become the first path component (with the remaining components filled in
as above)

3. Calling any or all of
abspath/expanduser/expandvars/normcase/normpath/realpath is the
responsibility of the library user as far as os.path.commonprefix is
concerned. Should that behaviour be retained for an os.path.commonpath
function, or should some of them (such as os.path.abspath) be called
automatically?
History
Date User Action Args
2008-12-30 13:55:42ncoghlansetrecipients: + ncoghlan, loewis, skip.montanaro, laxrulz777
2008-12-30 13:55:42ncoghlansetmessageid: <1230645342.3.0.0583669451709.issue4755@psf.upfronthosting.co.za>
2008-12-30 13:55:41ncoghlanlinkissue4755 messages
2008-12-30 13:55:40ncoghlancreate