A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2000-August/008388.html below:

[Python-Dev] Re: os.path.commonprefix breakage

[Python-Dev] Re: os.path.commonprefix breakageSkip Montanaro skip@mojam.com (Skip Montanaro)
Wed, 16 Aug 2000 23:04:54 -0500 (CDT)
>>>>> "Mark" == Mark Hammond <MarkH@ActiveState.com> writes:

    Mark> I believe that Skip recently made a patch to os.path.commonprefix
    Mark> to only return the portion of the common prefix that corresponds
    Mark> to a directory.

    Mark> I have just dicovered some code breakage from this change.  On
    Mark> 1.5.2, the behaviour was:

    >>>> os.path.commonprefix(["../foo/bar", "../foo/spam"])
    Mark> '../foo/'

    Mark> While since the change we have:
    Mark> '../foo'

I'm sure it can be argued that the slash should be there.  The previous
behavior was clearly broken, however, because it was advancing
character-by-character instead of directory-by-directory.  Consequently,
calling 

    os.path.commonprefix(["/home/swen", "/home/swenson"])

would yield the most likely invalid path "/home/sw" as the common prefix.

It would be easy enough to append the appropriate path separator to the the
result before returning.  I have no problem with that.  Others with more
knowledge of path semantics should chime in.  Also, should the behavior be
consistent across platforms or should it do what is correct for each
platform on which it's implemented (dospath, ntpath, macpath)?

Skip




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