Dict utils
dict_merge(dct, merge_dct, add_keys=True)
Recursive dict merge. Inspired by :meth:dict.update(), instead of
updating only top-level keys, dict_merge recurses down into dicts nested
to an arbitrary depth, updating keys. The merge_dct is merged into
dct.
This version will return a copy of the dictionary and leave the original arguments untouched.
The optional argument add_keys, determines whether keys which are
present in merge_dict but not dct should be included in the
new dict.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dct |
dict
|
onto which the merge is executed |
required |
merge_dct |
dict
|
dct merged into dct |
required |
add_keys |
bool
|
whether to add new keys |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
updated dict |