-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
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
GH-101357: Suppress OSError
from pathlib.Path.exists()
and is_*()
#118243
Conversation
…`is_*()` Suppress all `OSError` exceptions from `pathlib.Path.exists()` and `is_*()` rather than a selection of more common errors as we do presently. Also adjust the implementations to call `os.path.exists()` etc, which are much faster on Windows thanks to pythonGH-101196.
What do you intend to do with #117858? This pull request includes all its changes (except for the news entry). |
They have some overlap but they're not quite the same:
|
Is it worth pointing out that this brings them into line with the There might also be value in some kind of conceptual comment that these functions mean what they say if they return |
Thanks for the feedback!
It seems quite redundant to me, as the existing docs for each method are clear that edit: re-reading this comment, I think I came across too strong. If you think it's important, I can include some conceptual remarks as you suggest. |
I think it's helpful for people who come to our docs not just for reference, but to find out what they should do. But I also can't come up with great wording that doesn't have so many qualifiers that you'd need to be an expert to understand it anyway. Maybe it's a matter of phrasing it more like: "Returns Basically, "if you use this, here's what you'll get; if you actually wanted this, here's what you should do". But it's more of a rewrite, and maybe not worth your time or interest. I'm not going to force it, the current PR is fine. |
Makes sense! I'll experiment and see if I can make that sort of thing work. Ta! |
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.
Love it. But do consider other feedback as well, if there's something that can make it even more approachable.
Thanks very much for the review! |
…`is_*()` (python#118243) Suppress all `OSError` exceptions from `pathlib.Path.exists()` and `is_*()` rather than a selection of more common errors as we do presently. Also adjust the implementations to call `os.path.exists()` etc, which are much faster on Windows thanks to pythonGH-101196.
Suppress all
OSError
exceptions frompathlib.Path.exists()
andis_*()
rather than a selection of more common errors as we do presently. Also adjust the implementations to callos.path.exists()
etc, which are much faster on Windows thanks to GH-101196.pathlib.Path.is_file
and friends #101357📚 Documentation preview 📚: https://cpython-previews--118243.org.readthedocs.build/