spiketools.utils.base.combine_dicts

spiketools.utils.base.combine_dicts(dicts)[source]

Combine a list of dictionaries together.

Parameters:
dictslist of dict

Dictionaries to combine.

Returns:
dict

Combined dictionary.

Notes

If multiple dictionaries have the same keys, the value of the last dictionary is kept.

Examples

Combine two dictionaries:

>>> dict1 = {'a' : 1, 'b' : 2}
>>> dict2 = {'c' : 3, 'd' : 4}
>>> combine_dicts([dict1, dict2])
{'a': 1, 'b': 2, 'c': 3, 'd': 4}