Re: map, index

2010-03-28 Thread Luis Quesada
Paul Rubin wrote: Luis Quesada writes: [ id*v for id,v in enumerate(L) ] Cool! Thanks! If you really want to write that in pointfree style (untested): import itertools, operator ... itertools.starmap(operator.mul, enumerate(L)) For your other question, you could probably do someth

Re: map, index

2010-03-28 Thread Paul Rubin
Luis Quesada writes: >> [ id*v for id,v in enumerate(L) ] > Cool! Thanks! If you really want to write that in pointfree style (untested): import itertools, operator ... itertools.starmap(operator.mul, enumerate(L)) For your other question, you could probably do something ugly with ifil

Re: map, index

2010-03-28 Thread Luis Quesada
Duncan Booth wrote: Luis Quesada 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 -- http://mail.python.org/mailman/listinfo/python-list

Re: map, index

2010-03-28 Thread Duncan Booth
Luis Quesada 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) ] -- http://mail.python.org/mailman/listinfo/python-list