Jeff Hall wrote:
... For those that prefer not to add functions all willy-nilly, would it not be better to add a "delimiter" keyword that defaults to False? Then "delimiter=False" will function with the current functionality unchanged while
os.path.commonprefix(["bob/export/home", "bob/etc/passwd"], delimiter = "/")
The proper call should be: os.path.commonprefix(["bob/example", "bob/etc/passwd"], delimiter=True)
and output: 'bob' (path to the common directory)
Perhaps even call the keyword arg "delimited," rather than "delimiter." On Windows, I'd like to see: os.path.commonprefix(['a/b/c.d/e'f', r'a\b\c.d\eve'], delimited=True) return either 'a/b/c.d' or r'a\b\c.d' Perhaps even ['a', 'b', 'c.d'] (suitable for os.path.join).
--Scott David Daniels Scott.Daniels@Acm.Org