[Tutor] Re: glob or filter help

Javier Ruere javier at ruere.com.ar
Sat Jan 22 17:25:10 CET 2005


Jay Loden wrote:
> Thanks! That's exactly the kind of feedback I was looking for.  If
it's not
> too much trouble, do you think you could explain how lambda works, or
just
> point me towards a lambda explanation/tutorial that a new programmer can
> understand?  It seems to give you some great power but I really don't
> understand how it works.

  Lambda defines anonymous functions. It has some restrictions like that
the function must be expressed in one line and there can be no
assigments. The syntax can be found in [1].
  Though I personaly like this keyword, I must say that it can make code
less readable so I tend to use it for only for extremely simple
snippets. The example given in the previous mail is almost too big. But
then again, one must try things out to learn so use it and find your own
balance.
  Also the BDFL has said he is unhappy with lambda (and filter, reduce
and map) so he may remove this keyword in the future (but not before
Python3000)[2].

Javier

[1] http://www.python.org/doc/2.4/ref/lambdas.html
[2] Look in the user list if you want to learn more about this topics.



More information about the Tutor mailing list