[Python-Dev] os.path.commonprefix

Armin Rigo arigo@tunes.org
Fri, 13 Dec 2002 15:46:47 -0800 (PST)


Hello Skip,

On Mon, Dec 09, 2002 at 05:18:42PM -0600, Skip Montanaro wrote:
> How about just adding commonpathprefix?  As I mentioned before, there's an
> implementation in Tools/scripts/trace.py.

Yes, providing a semi-broken version for compatibility is something, but
providing the expected behavior too is much better (and clearly marks the
cases where the previous version must not be used, by providing an
alternative).

The trace.py implementation seems broken because it directly uses os.sep
instead of functions of os.path, ignoring os.altsep and possibly other
platform-specific issues.

> The docs for the function state, "Note that this may return invalid paths
> because it works a character at a time."  I suspect that's sufficient.

Indeed.


Armin