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

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

Issue 10395: new os.path function to extract common prefix based on path components
Patch Set: Created 5 years, 4 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/ntpath.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Doc/library/os.path.rst Sat Jul 12 18:26:03 2014 +0300
+++ b/Doc/library/os.path.rst Sun Jul 13 21:30:38 2014 +0300
@@ -66,11 +66,24 @@
empty string (``''``).
+.. function:: commonpath(paths)
+
+ Return the longest common sub-path of each pathname in the sequence
+ *paths*. Raise ValueError if *paths* contains both absolute and relative
+ pathnames, or if *paths* is empty. Unlike :func:`commonprefix`, this
+ returns a valid path.
+
+ Availability: Unix, Windows
+
+ .. versionadded:: 3.5
+
+
.. function:: commonprefix(list)
- Return the longest path prefix (taken character-by-character) that is a prefix
- 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.
+ Return the longest path prefix (taken character-by-character) that is a
+ prefix 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. To obtain a valid path, see :func:`commonpath`.
.. function:: dirname(path)
« no previous file with comments | « no previous file | Lib/ntpath.py » ('j') | no next file with comments »

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