Skip to content

Instantly share code, notes, and snippets.

View toast254's full-sized avatar
🐧

toast254 toast254

🐧
View GitHub Profile
@toast254
toast254 / dict_merge.py
Last active May 16, 2017 13:39 — forked from angstwad/dict_merge.py
Recursive dictionary merge in Python 3
# -*- coding: utf-8 -*-
import collections
def dict_merge(dct: dict, merge_dct: dict):
""" 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``.