[Tutor] Lists...

alan.gauld@bt.com alan.gauld@bt.com
Mon, 4 Jun 2001 11:38:02 +0100


> > def intersect_eas(L1, L2):
> >     '''The easiest way for Alan G, requires nested_scopes'''
> >     return filter(lambda x: (x in L2), L1)

OK a version not requiring nested scopes...

def intersect(L1,L2):  
    return filter(lambda x,y=L2:(x in y), L1)

Still not fast tho'... :-)

Alan g.

PS I needed something similar for a web page that 
has to run on py 1.5.1 so nested scopes were no use to me...