This module provides a way to find differences between simple and complex (nested) objects.
This module do what others do (think of difflib / DeepDiff / ObjDiff), but the way I like, and with some magic.
fromdifferimportDifferdiffer=Differ()
diff=differ.compare(object1, object2)
# diff is a Difference instance that can be traversed:You can also play with inheritance from the Diffing class, that will override the bitwise xor operator ('^') so it will produces differencies:
fromdifferimportDiffingclassMyClass(Diffing):
passa=MyClass()
b=MyClass()
diff=a^b# diff is a Difference instance