r = {} for x in a: if x not in b: r[x] = r[a] for x in b: if x not in a: r[x] = r[b]
I know, this is wrong :-] This looks better: r = {} for x in a: if x not in b: r[x] = a[x] for x in b: if x not in a: r[x] = b[x] Bearophile -- http://mail.python.org/mailman/listinfo/python-list