-
-
Notifications
You must be signed in to change notification settings - Fork 31k
New issue
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
bpo-37689: add Path.is_relative_to() method #14982
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shihai1991 Thanks for the contribution! I definitely think that this function would be quite helpful.
I did some testing in the interpreter after installing python through your branch:
OS: Arch Linux 5.2.3
Looks good to me! I just had a few minor suggestions:
Misc/NEWS.d/next/Library/2019-07-27-18-00-43.bpo-37689.glEmZi.rst
Outdated
Show resolved
Hide resolved
@pitrou Hi, Antoine. pls review this PR, if you have free time, thanks :) |
@shihai1991 Btw, after you've made any changes based on suggestions you can use "Resolve conversation" to show that each one has been addressed (or directly commit the suggestion to the PR). Thanks for making the recommended changes (: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this. Please find some comments below.
Doc/library/pathlib.rst
Outdated
@@ -539,6 +539,20 @@ Pure paths provide the following methods and properties: | |||
ValueError: '/etc/passwd' does not start with '/usr' | |||
|
|||
|
|||
.. method:: PurePath.is_relative_to(*other) | |||
|
|||
Return the boolean result that this path is relative to *other* path. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about Return whether this path is relative to the *other* path
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, this would be an improvement over my earlier suggestion. Since it's modifying a verb, "Return" in this case, I think it might be slightly more correct to explicitly specify the "or not":
Return whether or not this path is relative to the *other* path
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ops, i am not a native english speaker, so i have no idea about "whether(or not)" :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shihai1991 That's okay, the distinction is often a pain, even for those of us who are native speakers (:
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 |
np, looks I need change my habit(because i am a gerrit user before:) |
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, this looks good to me. I just have a minor suggestion on renaming the parameter as mentioned inline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since other methods already have other
parameter, I think we're good to go on this.
LGTM 🌮
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update! Just one additional comment and I think we're good to go.
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. |
Thank you @shihai1991 ! |
https://bugs.python.org/issue37689