DicMer

DicMer is a Python mini library for recursively merging dictionaries.

Following example:

from dicmer import dict_merge

a = {
    'string': 'Lorem Ipsum',
    'dicts': {
        'b1': 'It is simply dummy text',
        'b2': {
            'b2_1': 'Printing and typesetting industry',
            'b2_2': 'It has survived not only five centuries',
        }
    },
    'list': [
        'What is Lorem Ipsum?',
        'Where does it come from?',
    ]
}

b = {
    'dicts': {
        'b2': {
            'b2_1': 'WARNING: This key was overwritten!',
            'b2_3': 'WARNING: This key was aded!',
        },
        'b3': 'WARNING: This key was added!'
    },
    'list': [
        'Why do we use it?',
        'Where can I get some?',
    ],
    'new key': {
        'I am': 'a new string!'
    }
}

print(dict_merge(a, b))

Will provide following result:

{
    'string': 'Lorem Ipsum', 
    'dicts': {
        'b1': 'It is simply dummy text', 
        'b2': {
            'b2_1': 'WARNING: This key was overwritten!', 
            'b2_2': 'It has survived not only five centuries', 
            'b2_3': 'WARNING: This key was aded!'
        }, 
        'b3': 'WARNING: This key was added!'
    },
    'list': [
        'What is Lorem Ipsum?',
        'Where does it come from?',
        'Why do we use it?',
        'Where can I get some?'
    ], 
    'new key': {
        'I am': 'a new dict!'
    }
}