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

sismex01 at hebmex.com sismex01 at hebmex.com
Tue Nov 26 11:22:08 EST 2002


> From: grante at visi.com [mailto:grante at visi.com]
> Sent: Tuesday, November 26, 2002 10:10 AM
> 
> 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?
>

Indeed it's a difficult question; let's ponder it for a sec...
(or ten).

:-)

-gustavo




More information about the Python-list mailing list