Python complaints

François Pinard pinard at iro.umontreal.ca
Mon Dec 13 13:07:39 EST 1999


"Tim Peters" <tim_one at email.msn.com> écrit:

> It's not the functionality of "map" that's objectionable, it's the
> politics.

Oh, I see.

> The unwanted side-effect is that their addition opened the doors
> to endless clamoring for more of the same, and griping about the
> limitations of lambda (which was conceived as a minor convenience,
> not as the foundation of an alternative programming style).

Guido could keep `map', `reduce' and `filter', and get rid of `lambda'.
I guess it might solve the bigger part of the political problem. :-)

> 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]

The main thing, above, is that you are getting rid of `lambda'.  But,
to be honest, you are also avoiding the need for an accessory function.

Yet, accessory functions are easy to write, and contribute somewhat to
the better documentation of the Python code.  (A bit the same as writing
a class to produce closures is more cumbersome than the Scheme way, but
yields better documentation for such effects, a bit "unusual" in Python.)

> In the bowels of DejaNews [...]

One of these days, I should learn how to use this famous `DejaNews'
everybody speaks about :-).  I am rather disconnected, am I not? :-)

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard






More information about the Python-list mailing list