-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
filecmp.dircmp does not allow non-shallow comparisons #57141
Comments
While filecmp.cmp and filecmp.cmpfiles allow a shallow option to be specified to invoke a more involved comparison of files, filecmp.dircmp does not. It is limited to shallow-only comparisons. This could be solved quite easily by adding a shallow keyword option to dircmp then changing the phase3 method to the following. def phase3(self): # Find out differences between common files
xx = cmpfiles(self.left, self.right, self.common_files, self.shallow)
self.same_files, self.diff_files, self.funny_files = xx |
Thanks for the report. Unfortunately 2.7 is closed to new features and the module is removed in 3.x, so there is nothing to do here. |
filecmp is still there in Python 3.3 Alpha 3. I can't find any reference to it being deprecated. |
Lennart, I saw your response on StackOverflow ;-). |
+1 for this. Whether or not this feature is implemented, I think the documentation should state that directory comparisons are done using "shallow=True". I created bpo-15250 for this. |
Allowing dircmp() to accept a file comparison function is another option to consider that may address more needs going forward. shallow=False could be achieved by passing lambda a, b: filecmp.cmp(a, b, shallow=False). |
Add input parameter 'shallow' to dircmp. Did not modify test_filecmp.py. |
Thanks for the patch @planet36, however I think this is sufficiently large a change that we should also have a test case for it. I'm also retargeting this to the current open branches for feature work - 3.6. |
Bah, wrong stage. patch review. |
@rbtcollins any update here? |
You can see that the latest comment is from 2015. Someone would need to take the patch, apply it to Python |
Co-authored-by: Steve Ward <[email protected]> Co-authored-by: Sanyam Khurana <[email protected]>
Co-authored-by: Steve Ward <[email protected]> Co-authored-by: Sanyam Khurana <[email protected]>
Co-authored-by: Steve Ward <[email protected]> Co-authored-by: Sanyam Khurana <[email protected]>
Co-authored-by: Steve Ward <[email protected]> Co-authored-by: Sanyam Khurana <[email protected]>
Co-authored-by: Steve Ward <[email protected]> Co-authored-by: Sanyam Khurana <[email protected]>
Thanks to everyone involved! |
Really wish github would send a notif on the issue when a PR is created to solve it! |
Not a bad idea. Did bpo do so? (I cannot remember either way for sure.) Given the absence of such notices, the PR author should have requested a review from you. If not already, the devguide should say something about looking for participants (preferably recent) who are members of 'Python' or 'python/core'. (bpo starred our names on comments.) |
Co-authored-by: Steve Ward <[email protected]> Co-authored-by: Sanyam Khurana <[email protected]>
Co-authored-by: Steve Ward <[email protected]> Co-authored-by: Sanyam Khurana <[email protected]>
Should the new parameter be made keyword-only? I feel we usually do that for newly added optional parameters. We have a little bit of time left before the RC phase to change this. |
It is our general practice to make new optional parameters keyword-only, even if the existing parameters are all positional-or-keyword. Passing this parameter as positional would look confusing and could be error-prone if additional parameters are added in the future.
Submitted #121767 to make the new parameter keyword-only. |
It is our general practice to make new optional parameters keyword-only, even if the existing parameters are all positional-or-keyword. Passing this parameter as positional would look confusing and could be error-prone if additional parameters are added in the future.
…ythonGH-121767) It is our general practice to make new optional parameters keyword-only, even if the existing parameters are all positional-or-keyword. Passing this parameter as positional would look confusing and could be error-prone if additional parameters are added in the future. (cherry picked from commit 50eec50) Co-authored-by: Jelle Zijlstra <[email protected]>
…GH-121767) (#121777) It is our general practice to make new optional parameters keyword-only, even if the existing parameters are all positional-or-keyword. Passing this parameter as positional would look confusing and could be error-prone if additional parameters are added in the future. (cherry picked from commit 50eec50) Co-authored-by: Jelle Zijlstra <[email protected]>
…ython#121767) It is our general practice to make new optional parameters keyword-only, even if the existing parameters are all positional-or-keyword. Passing this parameter as positional would look confusing and could be error-prone if additional parameters are added in the future.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
Linked PRs
The text was updated successfully, but these errors were encountered: