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

Unified Diff: Doc/library/os.path.rst

Issue 10395: new os.path function to extract common prefix based on path components
Patch Set: Created 7 years, 2 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
« no previous file with comments | « no previous file | Lib/posixpath.py » ('j') | Lib/posixpath.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Doc/library/os.path.rst Mon Nov 05 00:56:02 2012 +1000
+++ b/Doc/library/os.path.rst Sun Nov 04 11:05:17 2012 -0500
@@ -60,6 +60,18 @@
of all paths in *list*. If *list* is empty, return the empty string (``''``).
Note that this may return invalid paths because it works a character at a time.
+.. function:: commonpath(paths)
+
+ Return the longest common sub-path of each pathname in the sequence
+ *paths*. The paths must be absolute, otherwise a ValueError is raised.
+ If *paths* is empty, return ``None``. If each path ends with a path
+ separator, the returned sub-path will also end with a separator, otherwise
+ it will not. Unlike :func:`commonprefix`, this returns a valid path.
+
+ Availability: Unix.
+
+ .. versionadded:: 3.4
+
.. function:: dirname(path)
« no previous file with comments | « no previous file | Lib/posixpath.py » ('j') | Lib/posixpath.py » ('J')

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