map, index

Luis Quesada l.quesada at 4c.ucc.ie
Sun Mar 28 16:34:12 CEST 2010


Duncan Booth wrote:
> Luis Quesada <l.quesada at 4c.ucc.ie> wrote:
> 
>> Is there a way 
>> of writing the following without using zip:
>>      map(lambda (id,v):id*v,zip(range(len(L)),L))
> 
> [ id*v for id,v in enumerate(L) ]
Cool! Thanks!
Cheers,
Luis



More information about the Python-list mailing list