bpo-323042: Document how to remove a suffix of a pathlib.Path by sotte · Pull Request #8655 · python/cpython · GitHub
Skip to content

bpo-323042: Document how to remove a suffix of a pathlib.Path - #8655

Merged
berkerpeksag merged 3 commits into
python:masterfrom
sotte:improve_pathlib_with_suffix_documentation
Aug 3, 2018
Merged

berkerpeksag merged 3 commits into
python:masterfrom
sotte:improve_pathlib_with_suffix_documentation

Conversation

@sotte

@sotte sotte commented Aug 3, 2018

Copy link
Copy Markdown
Contributor

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_suffix function of the Path class of pathlib and 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_suffix has you covered already. I'm just documenting this feature with this PR.

https://bugs.python.org/issue323042

@the-knights-who-say-ni

Copy link
Copy Markdown

@berkerpeksag berkerpeksag left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also remove the outdated comment in Lib/pathlib.py?

# XXX if suffix is None, should the current suffix be removed?

@sotte

sotte commented Aug 3, 2018

Copy link
Copy Markdown
Contributor Author

Sure. I also documented the empty string case in the docstring.

Comment thread Lib/pathlib.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style nit: We don't use reST markup in docstrings.

@sotte
sotte force-pushed the improve_pathlib_with_suffix_documentation branch from 6b7a3e7 to 7a8d530 Compare August 3, 2018 19:12
@sotte

sotte commented Aug 3, 2018

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback!

FYI: In some places in pathlib.py rst-style comments are used. One could clean that up at some point.

@sotte

sotte commented Aug 3, 2018

Copy link
Copy Markdown
Contributor Author

Should I squash the commits or is any other action required from my side?

@berkerpeksag
berkerpeksag merged commit 46dc4e3 into python:master Aug 3, 2018
@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @sotte for the PR, and @berkerpeksag for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7.
🐍🍒⛏🤖

@bedevere-bot

Copy link
Copy Markdown

GH-8661 is a backport of this pull request to the 3.7 branch.

@bedevere-bot

Copy link
Copy Markdown

GH-8662 is a backport of this pull request to the 3.6 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 3, 2018
(cherry picked from commit 46dc4e3)

Co-authored-by: Stefan Otte <stefan.otte@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 3, 2018
(cherry picked from commit 46dc4e3)

Co-authored-by: Stefan Otte <stefan.otte@gmail.com>
@berkerpeksag

Copy link
Copy Markdown
Member

Thanks!

Should I squash the commits or is any other action required from my side?

No, I was just waiting for tests to be completed.

@sotte

sotte commented Aug 3, 2018

Copy link
Copy Markdown
Contributor Author

berkerpeksag pushed a commit that referenced this pull request Aug 3, 2018
(cherry picked from commit 46dc4e3)

Co-authored-by: Stefan Otte <stefan.otte@gmail.com>
berkerpeksag pushed a commit that referenced this pull request Aug 3, 2018
(cherry picked from commit 46dc4e3)

Co-authored-by: Stefan Otte <stefan.otte@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants