Function upref::core::dict_merge

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. 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.

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