Arnaud Delobelle: > Thanks to the power of negative numbers, you only need one dict: > > d = defaultdict(int) > for x in a: > d[x] += 1 > for x in b: > d[x] -= 1 > # a and b are equal if d[x]==0 for all x in d: > not any(d.itervalues())
Very nice, I'll keep this for future use. Someday I'll have to study this new new kind of numbers that can represent borrowed items too. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list