ZeD <vito.detullio at gmail.com> writes: > > desired_result = B + sorted(x for x in A if x not in B) > this. is. cool. Actually it's better to use a set if B is large: B2 = set(B) desired_result = B + sorted(x for x in A if x not in B2) That avoids a linear search through B for each element of A.