[Baypiggies] lambda for newbies

Dan Weeks dan+baypiggies at danimal.org
Fri May 11 14:21:11 CEST 2007


On 2007-05-11 01:03, Shannon -jj Behrens threw down some bits like this:
> Hey guys,
> 
> I often hear Python newbies who are confused about lambda.  Let's
> start with some code:

> These days, with list comprehensions, you can just write:

While it's great that to teach about lambda and lisp-like programming
I think focusing on list comprehensions is well more worth while,
especially since they're more pythonic and the lisp-like lambda,
filter(), map(), and reduce() are slated for removal in Python 3000.
Of course there is code that exists that needs to be maintained now and
you've done a good job of explaining lambda for newbies so they can do
that.  

Taking the approach that lambda, filter, map, and reduce are okay in
existing code is fine, but all new code really should be using lists
comprehensions.  Of course here I am saying this and not following
jj's example of providing a tutorial.  Maybe if I have more time today
I can reply with a list comprehension version of what jj gave.

Dan



More information about the Baypiggies mailing list