compares two cascading dicts
- dict1 : dict, list, or tuple
- the first object to compare
- dict2 : dict, list, or tuple
- the second object to compare
- encoding : str or None or False
- controls how comparisons are made when one value is a str, and one is a
unicode; if None, then comparisons are simply made with == (so ascii
characters will compare equally); if the value False, then unicode and
str are ALWAYS considered different - ie, u’foo’ and ‘foo’ would not be
considered equal; otherwise, it should be the name of a unicode
encoding, which will be applied to the unicode string before comparing
- useAddedKeys : bool
- if True, then similarly to how ‘RemovedKey’ objects are used in the
returned diferences object (see the Returns section), ‘AddedKey’ objects
are used for keys which exist in dict2 but not in dict1; this allows
a user to distinguish, purely by inspecting the differences dict, which
keys are brand new, versus merely changed; mergeCascadingDicts will
treat AddedKey objects exactly the same as though they were their
contents - ie, useAddedKeys should make no difference to the behavior
of mergeCascadingDicts
- both : set
- keys that were present in both (non-recursively)
(both, only1, and only2 should be discrete partitions of all the keys
present in both dict1 and dict2)
- only1 : set
- keys that were present in only1 (non-recursively)
- only2 : set
- keys that were present in only2 (non-recursively)
- differences : dict
- recursive sparse dict containing information that was ‘different’ in
dict2 - either not present in dict1, or having a different value in
dict2, or removed in dict2 (in which case an instance of ‘RemovedKey’
will be set as the value in differences)
Values that are different, and both dictionaries, will themselves have
sparse entries, showing only what is different
The return value should be such that if you do if you merge the
differences with d1, you will get d2.