GeezerVison is showing github.com — GH-130608: Remove `dirs_exist_ok` argument from `pathlib.Path.copy()` by barneygale · Pull Request #130610 · python/cpython
Conversation
barneygale
commented
Feb 26, 2025
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Per the issue:
(Background: pathlib.Path.copy() is new in Python 3.14, so it hasn't been released yet.)
I don't think there's a compelling case to support a dirs_exist_ok argument in the initial version of Path.copy(). Most Python users don't need "copy and merge directory" functionality. Particularly unlucky users might use the wrong source or target path, and perform a large directory tree merge that is difficult to unpick.
We could add this back in later, in response to user demand.
📚 Documentation preview 📚: https://cpython-previews--130610.org.readthedocs.build/
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…opy()`
This feature isn't sufficiently motivated.
|
Hi Paul, I requested your review because you helped with a similar PR few months back: #123337
To explain my motivations a bit:
I'm trying to be extremely careful about adding pathlib features I might later regret. It's already happened more than once while I've been maintaining pathlib 🙃
In this case, the implementation uses WritablePath.mkdir(exist_ok=dirs_exist_ok), but I'd like to remove the exist_ok argument because it implies readability, whereas WritablePath is otherwise write-only. Maybe this is solvable some other way, but for now I'd quite like to play it safe.
Hope that makes sense, thank you.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Looks OK to me, and I agree with your reasoning. Until we know how people are going to use the new extensibility, it's better to keep the requirements minimal. We can add functionality later if it's needed, and 3rd party providers won't have a problem with it.
|
barneygale reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
barneygale
commented
Feb 28, 2025
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
Excellent, thanks for your help :]
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
pfmoore
pfmoore approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|