Python Tutorial Was: Guido's regrets: filter and map
Grant Edwards
grante at visi.com
Mon Nov 25 13:56:10 EST 2002
In article <arsni0$pnk$1 at news.netpower.no>, David Brown wrote:
>> I never liked filter, map and reduce.
So don't use them. ;)
> I find lambda and map very useful - used carefully, they can be of great
> value to the readability of a program (letting you write exactly what you
> mean in a short space, without cluttering up the code with unnecessary
> "def"s and function names that are not needed). Filter is less useful -
> list comprehensions are often easier to read and write.
> Reduce is a lot
> less useful, because it is a lot less obvious what it is doing.
I find both map and filter easily replaced with list comprehensions. How do
you replace a reduce call with a list comprehension?
--
Grant Edwards grante Yow! World War Three can
at be averted by adherence
visi.com to a strictly enforced
dress code!
More information about the Python-list
mailing list