bpo-34329: Doc'd how to remove suffix of pathlib.Path() (GH-8655)
(cherry picked from commit 46dc4e34ed8005a688d7f3512844ef227a3465f4)
Co-authored-by: Stefan Otte <stefan.otte@gmail.com>
diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst
index 3d28a1b..0929ee2 100644
--- a/Doc/library/pathlib.rst
+++ b/Doc/library/pathlib.rst
@@ -559,7 +559,8 @@
.. method:: PurePath.with_suffix(suffix)
Return a new path with the :attr:`suffix` changed. If the original path
- doesn't have a suffix, the new *suffix* is appended instead::
+ doesn't have a suffix, the new *suffix* is appended instead. If the
+ *suffix* is an empty string, the original suffix is removed::
>>> p = PureWindowsPath('c:/Downloads/pathlib.tar.gz')
>>> p.with_suffix('.bz2')
@@ -567,6 +568,9 @@
>>> p = PureWindowsPath('README')
>>> p.with_suffix('.txt')
PureWindowsPath('README.txt')
+ >>> p = PureWindowsPath('README.txt')
+ >>> p.with_suffix('')
+ PureWindowsPath('README')
.. _concrete-paths: