Python Tutorial Was: Guido's regrets: filter and map

Grant Edwards grante at visi.com
Tue Nov 26 11:10:17 EST 2002


In article <mailman.1038322838.8306.python-list at python.org>, sismex01 at hebmex.com wrote:

> Anyway, to each it's own.  But I do concurr with those who
> say that with the acquisition of list comprehensions, map(),
> reduce(), filter(), lambda() et-al, should be on the road
> to deprecation and eventual elimination, being the black
> un-pythonic sheep of the family.

I see how you use list comprehensions to replace map and
filter, but I don't understand why list comprehensions are
touted as a replacement for reduce and lambda.  I use lamba
almost exclusively to generate anonymous functions that are
passed to GUI widgets.  How does a list comprehension solve
that problem?

In the case of reduce:

  sum = reduce(operator.add, valueList)

How is that expressed any better with a list comprension?

-- 
Grant Edwards                   grante             Yow!  I'm also against
                                  at               BODY-SURFING!!
                               visi.com            



More information about the Python-list mailing list