bpo-40148 Add PurePath.with_stem()#19295
Conversation
pitrou
left a comment
There was a problem hiding this comment.
This looks generally good to me, just one question.
There was a problem hiding this comment.
Yes, of course. Thanks. Fixed.
2996ed3 to
327c347
Compare
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
327c347 to
eac93d0
Compare
|
I have made the requested changes; please review again. |
|
Thanks for making the requested changes! @pitrou: please review the changes made to this pull request. |
Similar to
PurePath.with_name()andPurePath.with_suffix()there should be aPurePath.with_stem().A common use case would be appending something before the suffix:
path.with_stem(path.stem + '_v2')As of now this must be written more cumbersome as:
path.with_name(path.stem + '_v2' + path.suffix)While the implementation is just a slight modification of
with_name, I still think it's justified to add this method:with_name()andsuffixmanually together.https://bugs.python.org/issue40148