[1]:
import mdf_toolbox

Miscellaneous Utilities

dict_merge

dict_merge() will recursively merge two dictionaries. It takes two dictionaries as arguments, base and addition (in that order). The base dictionary is augmented with fields from addition. No data in base is overwritten or removed.

[2]:
base_dict = {
    "foo": 1,
    "bar": 2
}
add_dict = {
    "baz": 3,
    "bar": "not_added"
}
[3]:
mdf_toolbox.dict_merge(base_dict, add_dict)
[3]:
{'bar': 2, 'baz': 3, 'foo': 1}
[ ]: