List mapping?
Robert Cragie
rcc at nospamthanks_jennic.com
Fri Apr 14 12:07:46 EDT 2000
Remco Gerlich <scarblac-spamtrap at pino.selwerd.nl> wrote in message
news:slrn8fc4eu.1d0.scarblac-spamtrap at flits104-37.flits.rug.nl...
| Robert Cragie wrote in comp.lang.python:
| > > Howcome you use reduce at all?
| > >
| > > Works fine with just doing
| > >
| > > tuplist = map(lambda x: (mylist[x], mylist[x+1]), range(0,
len(mylist),
| > 2))
| >
| > Yep, that's neater. My excuse is that I've only been learning Python for
a
| > couple of weeks...
|
| In that case, forget you ever read something about map, lambda and reduce.
| Save it for later and code nice for loops now. 95% of the time, those
things
| only obfuscate code anyway.
'map' and 'reduce', perhaps. I think 'map' is syntactically neat for some
things, and not too confusing.
'lambda' is very useful, but, I think, quite confusing in its use, which is
partly why I did not see the simpler solution.
Robert Cragie
More information about the Python-list
mailing list