bpo-323042: Document how to remove a suffix of a pathlib.Path - #8655
Conversation
berkerpeksag
left a comment
There was a problem hiding this comment.
Could you also remove the outdated comment in Lib/pathlib.py?
# XXX if suffix is None, should the current suffix be removed?|
Sure. I also documented the empty string case in the docstring. |
There was a problem hiding this comment.
Style nit: We don't use reST markup in docstrings.
6b7a3e7 to
7a8d530
Compare
|
Thanks for the feedback! FYI: In some places in pathlib.py rst-style comments are used. One could clean that up at some point. |
|
Should I squash the commits or is any other action required from my side? |
|
Thanks @sotte for the PR, and @berkerpeksag for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7. |
|
GH-8661 is a backport of this pull request to the 3.7 branch. |
|
GH-8662 is a backport of this pull request to the 3.6 branch. |
(cherry picked from commit 46dc4e3) Co-authored-by: Stefan Otte <stefan.otte@gmail.com>
(cherry picked from commit 46dc4e3) Co-authored-by: Stefan Otte <stefan.otte@gmail.com>
|
Thanks!
No, I was just waiting for tests to be completed. |

bpo-323042: Document how to remove a suffix of a pathlib.Path
I didn't realize that you can remove a suffix with the
with_suffixfunction of thePathclass ofpathliband I always used a little utility function that I wrote.I wanted to add that functionality (removing of a suffix) and submit a PR but then I saw that
with_suffixhas you covered already. I'm just documenting this feature with this PR.https://bugs.python.org/issue323042