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

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to