Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(160645)

Unified Diff: Lib/macpath.py

Issue 4755: Common path prefix
Patch Set: Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Lib/macpath.py
===================================================================
--- Lib/macpath.py (revision 67929)
+++ Lib/macpath.py (working copy)
@@ -34,7 +34,6 @@
def normcase(path):
return path.lower()
-
def isabs(s):
"""Return true if a path is absolute.
On the Mac, relative paths begin with a colon,
@@ -45,7 +44,16 @@
colon = _get_colon(s)
return colon in s and s[:1] != colon
+def commonpathprefix(m, separator=None):
+ """Given a list of pathnames, returns the longest common leading component.
+ Unlike commonprefix(), commonpathprefix() considers path elements as
+ delimited by the defined separator (default: os.sep).
+ """
+ if separator is None:
+ separator = sep
+ return genericpath.commonpathprefix(m, separator)
+
def join(s, *p):
colon = _get_colon(s)
path = s
« Doc/library/os.path.rst ('K') | « Lib/genericpath.py ('k') | Lib/ntpath.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+