Skip to content

Overriding strategy loses unmatched keys #35

Answered by toumorokoshi
ruimelodev asked this question in Q&A
Discussion options

You must be logged in to vote

Hi! yeah, I think this is tricky: deepmerge doesn't include the functionality for different behaviors of merging based on nesting.

Since this is just different behavior on the first level, I'd suggest just writing a custom function to run deepmerge on the nested keys. Something like:

for key,  value in nxt.items():
    base[key] = my_merge.merge(base.get(key), value)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by toumorokoshi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question answered answered question
2 participants
Converted from issue

This discussion was converted from issue #23 on August 30, 2024 05:37.