Re: [Python-Dev] A wart which should have been repaired in 3.0?
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.dani...@acm.org ___ 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
Re: [Python-Dev] A wart which should have been repaired in 3.0?
I was thinking that the user could just define the delimiter character due to the differences amongst delimiters used in OS's... but if that isn't a problem (Skip seemed to think it wouldn't be) then my solution is functionally identical to the first one he proposed ___ 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
Re: [Python-Dev] A wart which should have been repaired in 3.0?
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
[Python-Dev] Commands for correctly merging to the python 3.0 maintenance branch
Getting the svnmerge-intergrated property right when merging trunk-py3k-release30 is a little tricky. The most concise set of instructions I have found which gets it right is to do the following in the 3.0 maintenance branch after committing to the py3k branch: svn update svnmerge merge -r py3k-rev svn revert . svnmerge -M -F py3k-rev test change still works, etc svn commit -F svnmerge-commit-message.txt Revert and property changes on . and running that second svnmerge line is also useful if you do a svn update after the first svnmerge and get a conflict on the svnmerge-intregrated property. The -M option tells the utility to only make the property changes, while the -F tells it to go ahead despite the existence of local modification. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia --- ___ 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