Skip to content

Instantly share code, notes, and snippets.

@hawksight
hawksight / dict_merge.py
Created January 19, 2018 13:47 — forked from angstwad/dict_merge.py
Recursive dictionary merge in Python3
import collections
def dict_merge(dct, merge_dct):
""" 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``.
:param dct: dict onto which the merge is executed
:param merge_dct: dct merged into dct

Keybase proof

I hereby claim:

  • I am hawksight on github.
  • I am sopost_peter (https://keybase.io/sopost_peter) on keybase.
  • I have a public key ASBS4k9mRg_wSTIdCdnuMKJdNG1MieOr5Tm_E_W0WynWRgo

To claim this, I am signing this object: