<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > try to use set. > L1 = [1,1,2,3,4] > L2 = [1,3, 99] > A = set(L1) > B = set(L2) > > X = A-B > print X > > Y = B-A > print Y > > Z = A | B > print Z
But how "efficient" is this? Could you be a bit more explicit on that point? What is the order of complexity of set([...]) or of A-B, B-A, A | B, A ^ B and A & B? - The Python Documentation leaves me completely in the dark in this regard. Sorting the two lists and then extracting A-B, B-A, A|B, A & B and A ^ B in one single pass seems to me very likely to be much faster for large lists. Regards, Christian -- http://mail.python.org/mailman/listinfo/python-list