Python complaints

Charles Boncelet boncelet at udel.edu
Tue Dec 14 06:13:25 EST 1999


Grant Edwards wrote:
> 
> In article <oqvh621zpw.fsf at titan.progiciels-bpi.ca>, François Pinard wrote:
> 
> >> There's nothing you can do with "map" you couldn't do "more Pythonically"
> >> with list comprehensions; e.g.
> >>     sq = map(lambda a: a**2, x)
> >> vs
> >>     sq = [a**2 for a in x]
> 
> I like the second syntax better, but having "lambda" available
> makes us Scheme geeks feel a bit more at home.

This is the first I've seen of this notation and it is simple and
(reasonably)
understandable.  But the savings is minimal versus normal Python

fx = []
for a in x:
    fx.append(a**2)

Am I missing something?
-- 
Charles Boncelet <boncelet at udel.edu>
University of Delaware
Newark DE 19716 USA
http://www.eecis.udel.edu/~boncelet/



More information about the Python-list mailing list