Currently the implementation will happily descend into the objects forever.
It would be great if it handled cycles by keeping a history of which objects are already being traversed.
So something like:
foo = {'a': None, 'b': 123}
foo['a'] = foo
Would ensure that b has the same value, but a points at the same object in the path. Or specifically at an object the same number of steps up the path.
fooL = {'a': None, 'b': 123}
fooL['a'] = fooL
fooR = {'a': None, 'b': 123}
fooR['a'] = fooR
recursive_diff(fooL, fooR) <- should find no differences and not get stuck
Currently the implementation will happily descend into the objects forever. It would be great if it handled cycles by keeping a history of which objects are already being traversed.
So something like:
Would ensure that
b
has the same value, buta
points at the same object in the path. Or specifically at an object the same number of steps up the path.