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

skip at pobox.com skip at pobox.com
Mon Dec 29 23:46:01 CET 2008


    Jeff> For those that prefer not to add functions all willy-nilly, would
    Jeff> it not be better to add a "delimiter" keyword that defaults to
    Jeff> False? Then "delimiter=False" will function with the current
    Jeff> functionality unchanged while

    Jeff> os.path.commonprefix(["bob/export/home", "bob/etc/passwd"], delimiter = "/")

    Jeff> would properly return

    Jeff> 'bob/'

On Windows what would you do with this crazy, but valid, path?

    c:/etc\\passwd

I don't do Windows, so don't have any idea if there is even an /etc/passwd
file on Windows.  I'd guess not, but that's not the point.  The point is
that you can use both / (aka ntpath.sep) and \ (aka ntpath.altsep) in
Windows pathnames.  See my patch (issue 4755) for a version of
os.path.<whatever> which works as at least I expect and should work
cross-platform.

Skip



More information about the Python-Dev mailing list