[Python-Dev] patch for os.path.commonprefix (changes semantics - pls review)

Skip Montanaro skip@mojam.com (Skip Montanaro)
Sun, 9 Jul 2000 11:03:00 -0500 (CDT)

os.path.commonprefix seems broken to me.  If you ask it to return the common
prefix of "/home/swen/spam" and "/home/swan/eggs", it returns "/home/sw".
Since we are talking file paths, not strings, I think the common prefix
should be "/home".  Since my patch changes the semantics of the function, I
submitted a patch via SF that implements what I believe to be the correct
behavior instead of just checking in the change, so people could comment on
it.  Also, since the version in ntpath.py was the same as the version in
posixpath.py I modified both, replacing "/" with os.sep (is that correct?).
Note that I can't check that it returns something useful on NT, though I
suspect it will.  There is no commonprefix function in macpath.py.  Is this
a function that would have no meaning on the Mac?

The patch is available for review at