[Python-ideas] os.path.commonprefix: Yes that old chestnut.

Serhiy Storchaka storchaka at gmail.com
Tue Mar 24 19:06:09 CET 2015


On 21.03.15 06:41, Paddy3118 wrote:
> I had to add a comment to an RC entry
> <http://rosettacode..org/wiki/Longest_common_prefix#Python>that was
> using os.path..commonprefix to compute the longest common prefix which
> it does regardless of path separators, (which is what it should do).
>
> It has been discussed before <http://bugs.python.org/issue10395>- it
> goes back to the nineties it seems, but we are still left with a
> misplaced function, (it should be str.commonprefix), with an awful hack
> of saying "yes we know its ballsed up" in the documentation
> <https://docs.python.org/3.5/library/os.path.html?highlight=commonprefix#os.path.commonprefix>.
>
> I guess we missed a great opportunity to fix this when we moved to
> Python 3 too!?
>
> The  fix seems clear: deprecate os.path.commonprefix whilst creating a
> true os.path.commonpath and str.commonprefix. The deprecated function
> should hang around and the standard libs modified to switch to the new
> function(s)
>
> I've heard that some religious people put obvious faults in their work
> as only their god should get so close to perfection - maybe that's why
> we still have this wart :-)

OK, if there are no objections and comments, I'll commit the recent 
patch for issue10395 (with only the doc change as Raymond suggested).




More information about the Python-ideas mailing list