#Needed if you're using python3
from functools import reduce
A = {(3,'x'):-2, (6,'y'):3, (8, 'b'):9}
B = {(3,'y'):4, (6,'y'):6}
#Merging all the key/value(s) inside one big list
C = list(A.items()) + list(B.items())
#C = [((3,'x'), -2), ((6,'y'), 3), ...]
#Keeping a list of all unique (hence the set) keys available
keys = set([key[0] for key in C])
#keys = set([(3,'x'), (6,'y'), ...])
result = {}
for key in keys:
#Extracing the pairs that corresponds to the current key
local = [item for item in C if item[0] == key]
#local = [((6,'y'), 3), ((6,'y'), 6)]
#Actually doing the sum and storing the ready to insert result
my_sum = reduce(lambda x,y: (x[0], x[1] + y[1]), local)
#my_sum = [((6,'y'), 9)]
#Actually inserting the result into the result set
result.update({my_sum[0]: my_sum[1]})
#result.update({(6,'y'): 9})
>>> result
{(3, 'y'): 4, (8, 'b'): 9, (3, 'x'): -2, (6, 'y'): 9}