>>> os.path.split('/foo/bar/') ('/foo/bar', '') >>> Jamming a trailing slash on the end is a bit wonky. I'm with Skip on saying that the slash should probably *not* be appended. It gives funny behavior with the split. Users should use .join() to combine the resulting with something else. The removal of a prefix is an interesting issue. No opinions there. Cheers, -g On Thu, Aug 17, 2000 at 01:32:25PM +1000, Mark Hammond wrote: > Hi, > I believe that Skip recently made a patch to os.path.commonprefix to only > return the portion of the common prefix that corresponds to a directory. > > I have just dicovered some code breakage from this change. On 1.5.2, the > behaviour was: > > >>> os.path.commonprefix(["../foo/bar", "../foo/spam"]) > '../foo/' > > While since the change we have: > '../foo' > > Note that the trailing slash has been dropped. > > The code this broke did similar to: > > prefix = os.path.commonprefix(files) > for file in files: > tail_portion = file[len(prefix):] > > In 1.6, the "tail_portion" result looks like an absolute path "/bar" and > "/spam", respectively. The intent was obviously to get absolute path names > back ("bar" and "spam") > > The code that broke is not mine, so you can safely be horrified at how > broken it is :-) The point, however, is that code like this does exist out > there. > > I'm obviously going to change the code that broke, and don't have time to > look into the posixpath.py code - but is this level of possible breakage > acceptable? > > Thanks, > > Mark. > > > > _______________________________________________ > Python-Dev mailing list > Python-Dev@python.org > http://www.python.org/mailman/listinfo/python-dev -- Greg Stein, http://www.lyra.org/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4