funcy icon indicating copy to clipboard operation
funcy copied to clipboard

Dict deep merge?

Open lucasteles opened this issue 2 years ago • 1 comments

Is there a way to deep merge a dict?

lucasteles avatar Sep 23 '22 21:09 lucasteles

From the top of my head:

from funcy import join_with, all, is_mapping

def deepmerge(*dicts):
    return join_with(deepmerge, dicts) if all(is_mapping, dicts) else dicts[-1]

Suor avatar Sep 25 '22 05:09 Suor