>> a = set(a) >> n = sum(item in a for item in b) > Why set? Does it matter if I say that items in A are already unique? Sets are hash-based, so it's (most probably) far more efficient for sets than for sequences (especially if we say about big/long ones). Regards, *j -- Jan Kaliszewski (zuo) <zuo at chopin.edu.pl>