summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorStefan Otte <stefan.otte@gmail.com>2018-08-03 20:49:42 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2018-08-03 20:49:42 (GMT)
commit46dc4e34ed8005a688d7f3512844ef227a3465f4 (patch)
treecbf2e5835ede278725ad4c66fb7d87e431509f17 /Lib
parent5a953fd0ab4d0f792f4c1537616b2ce8ee40d976 (diff)
downloadcpython-46dc4e34ed8005a688d7f3512844ef227a3465f4.zip
cpython-46dc4e34ed8005a688d7f3512844ef227a3465f4.tar.gz
cpython-46dc4e34ed8005a688d7f3512844ef227a3465f4.tar.bz2
bpo-34329: Doc'd how to remove suffix of pathlib.Path() (GH-8655)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/pathlib.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py
index 8431c29..4fe9d4a 100644
--- a/Lib/pathlib.py
+++ b/Lib/pathlib.py
@@ -807,8 +807,10 @@ class PurePath(object):
self._parts[:-1] + [name])
def with_suffix(self, suffix):
- """Return a new path with the file suffix changed (or added, if none)."""
- # XXX if suffix is None, should the current suffix be removed?
+ """Return a new path with the file suffix changed. If the path
+ has no suffix, add given suffix. If the given suffix is an empty
+ string, remove the suffix from the path.
+ """
f = self._flavour
if f.sep in suffix or f.altsep and f.altsep in suffix:
raise ValueError("Invalid suffix %r" % (suffix))