-
Notifications
You must be signed in to change notification settings - Fork 93
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
Wrong diff in case of removing a non last index of an array #100
Comments
@Glignos the current algorithm for comparing lists is very simple. In your case you would get a better result if you use sets instead of lists. You can propose a change of following lines dictdiffer/dictdiffer/__init__.py Lines 159 to 161 in efc1b73
|
I would propose to use |
I'm having the same issue, except with more complex data (dictionaries nested in dictionaries). I obviously have no idea what kind of fix this would be, but would love to see the functionality! |
Hey everyone! I found this thread when looking for a solution to calculate diffs between JSON documents. My schema contains a large list of objects at the top of the tree, so the subject issue is a deal breaker. I've prototyped my solution based on some of The main difficulty is in patch: I store all indices as they appear in the source array, and as I perform the patching I need to keep track of accumulating offset (e.g. if I delete a range, all subsequent indices need to be reduced by the length of deleted segment). Also, I don't need to invert diffs, so I didn't implement this functionality. Here's the link to my code and here's a little demo. My code uses a different format (structured dicts instead of tuples) but the idea is the same:
Works with documents as well
One difference is that my diffs are not reversible (but I don't think it'll be too hard to add this in case I need it). |
Suppose we have an array
Is that an error or did I misinterpret the usage of the library?
The text was updated successfully, but these errors were encountered: