summaryrefslogtreecommitdiffstats
path: root/Doc/library/os.path.rst
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-03-31 12:31:53 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-03-31 12:31:53 (GMT)
commit38220931433ab2d83892170e96a4d66764ce5338 (patch)
tree29fe3fe23b61b7627a30da3de0bc218fa9cdaa04 /Doc/library/os.path.rst
parentdd83bd2f9c8c328dc6b7655f33581e09df0e3611 (diff)
downloadcpython-38220931433ab2d83892170e96a4d66764ce5338.zip
cpython-38220931433ab2d83892170e96a4d66764ce5338.tar.gz
cpython-38220931433ab2d83892170e96a4d66764ce5338.tar.bz2
Issue #10395: Added os.path.commonpath(). Implemented in posixpath and ntpath.
Based on patch by Rafik Draoui.
Diffstat (limited to 'Doc/library/os.path.rst')
-rw-r--r--Doc/library/os.path.rst19
1 files changed, 16 insertions, 3 deletions
diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst
index 92631b2..e4fe44e 100644
--- a/Doc/library/os.path.rst
+++ b/Doc/library/os.path.rst
@@ -66,11 +66,24 @@ the :mod:`glob` module.)
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)