Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| >>> p.with_stem('final') | ||
| PureWindowsPath('c:/Downloads/final.txt') | ||
| >>> p = PureWindowsPath('c:/Downloads/pathlib.tar.gz') | ||
| >>> p.with_name('lib') |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Surely you mean with_stem here?
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Yes, of course. Thanks. Fixed.
| >>> p.with_stem('final') | ||
| PureWindowsPath('c:/Downloads/final.txt') | ||
| >>> p = PureWindowsPath('c:/Downloads/pathlib.tar.gz') | ||
| >>> p.with_step('lib') |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
"stem" not "step"
|
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 |
|
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