[New-bugs-announce] [issue10395] os.path.commonprefix broken by design

Ronald Oussoren report at bugs.python.org
Fri Nov 12 16:14:07 CET 2010

New submission from Ronald Oussoren <ronaldoussoren at mac.com>:

The documentation for os.path.commonprefix notes:

Return the longest path prefix (taken character-by-character) that is a prefix of all paths in list. If list is empty, return the empty string (''). Note that this may return invalid paths because it works a character at a time.

And indeed:

>>> os.path.commonprefix(['/usr/bin', '/usr/bicycle'])

This is IMHO useless behaviour for a function in the os.path namespace, I'd expect that os.path.commonprefix works with path elements (e.g. that the call above would have returned '/usr').

components: Library (Lib)
messages: 121038
nosy: ronaldoussoren
priority: low
severity: normal
status: open
title: os.path.commonprefix broken by design
versions: Python 3.2

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list