Boris Borcic wrote:
> Arnaud Delobelle wrote:
> (...)
>>
>> from itertools import chain
>>
>> def overlaps(lst):
>>     bounds = chain(*(((x[1],i), (x[2], i)) for i,x in enumerate(lst)))
> 
> imho, this is a uselessly painful equivalent of
> 
>       bounds = ((x[k],i) for i,x in enumerate(lst) for k in (1,2))

even more readable :

         bounds = ((bound(x),i) for bound in (min,max) for i,x in 
enumerate(lst))
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to