You know, all this path separator and list complication isn't really necessary, when you can just take the os.path.dirname() of the return from commonprefix().

Perhaps we could just add that recommendation to the docs?


At 04:46 PM 12/29/2008 -0600, s...@pobox.com wrote:

    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

_______________________________________________
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/pje%40telecommunity.com

_______________________________________________
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