merge_recursive
full name: tenpy.tools.misc.merge_recursive
parent module:
tenpy.tools.misc
type: function
- tenpy.tools.misc.merge_recursive(*nested_data, conflict='error', path=None)[source]
Merge nested dictionaries nested1 and nested2.
- Parameters:
*nested_data (dict of dict) – Nested dictionaries that should be merged.
path (list of str) – Path inside the nesting for useful error message.
conflict ("error" | "first" | "last") – How to handle conflicts: raise an error (if the values are different), or just give priority to the first or last nested_data that still has a value, even if they are different.
- Returns:
merged – A single nested dictionary with the keys/values of the nested_data merged. Dictionary values appearing in multiple of the nested_data get merged recursively.
- Return type: