set, dict and other structures

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Wed Feb 2 08:04:30 EST 2005


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




More information about the Python-list mailing list