For example I have two dicts:
Dict A: {\'a\': 1, \'b\': 2, \'c\': 3} Dict B: {\'b\': 3, \'c\': 4, \'d\': 5}
I need a pythonic way of \'comb
>>> A = {'a':1, 'b':2, 'c':3} >>> B = {'b':3, 'c':4, 'd':5} >>> c = {x: A.get(x, 0) + B.get(x, 0) for x in set(A).union(B)} >>> print(c) {'a': 1, 'c': 7, 'b': 5, 'd': 5}