Re: list comprehention

2006-01-24 Thread Morten Vold
On 24/01/2006 09:46, Peter Otten uttered: len(set([2, 2, 4, 1, 1]).intersection([2, 2, 5, 2, 4])) > 2 > Close, but no cigar. I need more coffee! (note to self: Always read entire problem set first) -- Morten -- http://mail.python.org/mailman/listinfo/python-list

Re: list comprehention

2006-01-24 Thread Morten Vold
On 23/01/2006 18:41, Mathijs uttered: >> len([ref.pop(ref.index(x)) for x in lis if x in ref]) > This is the type of solution I was hoping to see: one-liners, with no > use of local variables. As Tim Chase already wrote, it has only one > less elegant side: it alters the original ref list. > > T