diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/pathlib.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py index 44788c02c2f..5e130110f2e 100644 --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -823,8 +823,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)) |