substituting list comprehensions for map()

Ben Finney ben+python at benfinney.id.au
Mon Nov 2 05:01:48 EST 2009


Bruno Desthuilliers <bruno.42.desthuilliers at websiteburo.invalid> writes:

> Ben Finney a écrit :
> > (Does anyone know of a counter-example, a ‘map()’ operation that
> > doesn't have a correspondingly simple list comprehension?)
>
> ... depends on your definition of "simple". There are things I'd
> rather not write as a list comprehension...

That's why I qualified it as I did. I'd be interested to know a ‘map()’
usage where there isn't a correspondingly simple list comprehension;
that is, one that couldn't be done without being significantly more
complex than the corresponding ‘map()’ usage.

-- 
 \      “If we have to give up either religion or education, we should |
  `\              give up education.” —William Jennings Bryan, 1923-01 |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list