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

David Brown david at no.westcontrol.spam.com
Mon Nov 25 03:39:24 EST 2002


"Thomas Guettler" <pan-newsreader at thomas-guettler.de> wrote in message
news:pan.2002.11.24.08.05.38.521605.727 at thomas-guettler.de...
> On Sun, 24 Nov 2002 02:35:23 +0100, Simon Burton wrote:
>
> > Hello,
> >
> > I just read Guido's "python regret's" slide's from OSCON,
> >
http://www.google.com/search?hl=en&ie=ISO-8859-1&q=OSCON+%22python+regrets%2
2
> > and one thing i can't work out is,
> > he is saying we can do map() and filter() with list comprehensions (it's
> > faster too) eg.
>
> Thank you for this link.
>
> I never liked filter, map and reduce.
>
> I think it would be good to remove them from the python tutorial.
> I think the tutorial would be easier for newbies it
> it would be smaller.
>
>  thomas

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.

But while I like lambda and map, I think they could well be moved a lot
further back in the tutorial.  They are the kind of things that newbies will
have to be able to understand, but not necessarily learn to write
themselves - it is important that they are in the tutorial so that people
know where to look for explanations when they see them in code, but the
tutorial should not give the impression that full knowledge of lambda and
friends is essential to learning Python.






More information about the Python-list mailing list