Function upref::core::dict_merge¶
- Defined in File core.py
Function Documentation¶
-
upref.core.
dict_merge
(dct dct, merge_dct merge_dct, add_keys 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. Themerge_dct
is merged intodct
.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 inmerge_dict
but notdct
should be included in the new dict.Code from https://gist.github.com/angstwad/bf22d1822c38a92ec0a9
Args: dct (dict) onto which the merge is executed merge_dct (dict): dct merged into dct add_keys (bool): whether to add new keys
Returns: dict: updated dict