list comprehention

Steven D'Aprano steve at REMOVETHIScyber.com.au
Mon Jan 23 16:33:18 EST 2006


On Mon, 23 Jan 2006 17:41:55 +0000, Mathijs wrote:

> Op 19 jan 2006 vond "markscala at gmail.com" :
> 
>> another approach:
>> 
>> ref = [2,2,4,1,1]
>> lis = [2,2,5,2,4]
>> 
>> 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.

Because you like unreadable, incomprehensible, unmaintainable code?

*wink*



-- 
Steven.




More information about the Python-list mailing list