[Python-Dev] A wart which should have been repaired in 3.0?

skip at pobox.com skip at pobox.com
Sat Dec 27 00:40:51 CET 2008


The doc for os.path.commonprefix states:

    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.

I remember encountering this in an earlier version of Python 2.x (maybe 2.2
or 2.3?) and "fixed" it to work by pathname components instead of by
characters.  That had to be reverted because it was a behavior change and
broke code which used it for strings which didn't represent paths.  After
the reversion I then forgot about it.

I just stumbled upon it again.  It seems to me this would have been a good
thing to fix in 3.0.  Is this something which could change in 3.1 (or be
deprecated in 3.1 with deletion in 3.2)?

Skip



More information about the Python-Dev mailing list