[issue10395] new os.path function to extract common prefix based on path components

Serhiy Storchaka report at bugs.python.org
Tue Nov 13 10:24:17 CET 2012


Serhiy Storchaka added the comment:

Some conclusions of discussion at Python-ideas (http://comments.gmane.org/gmane.comp.python.ideas/17719):

1. commonpath() should eat double slashes in input (['/usr/bin', '/usr//bin'] -> '/usr/bin').  In any case the current implementation eats slashes on output (['/usr//bin', '/usr//bin'] -> '/usr/bin', not '/usr//bin').

2. commonpath() should raise an exception instead of returning None on incompatible input.

3. May be commonpath() should eat also '.' components and return '.' instead of '' when relative paths have no common prefix. I am not sure.

In general the current patch looks good enough.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10395>
_______________________________________


More information about the Python-bugs-list mailing list