Is there such an idiom?

Irmen de Jong irmen.NOSPAM at xs4all.nl
Sun Mar 19 19:44:02 EST 2006


Per wrote:

> how to find the number of common items between two list in linear-time?
> 

Not really sure about linear-time, but  you could try the following:

 >>> a=[1,2,3,4]
 >>> b=[3,4,5,6]
 >>> set(a) & set(b)
set([3, 4])


--Irmen



More information about the Python-list mailing list