Sunday, January 11, 2009

Another way to think about lambda

Until now I had problems understanding the lambda statement. I did not know how is it used and what does it actually do. The description in the Python documentation did explain it but not easy enought to remember it.

Now I have thought of something which helps me remember the purpose of lambda and its syntax.

It's the same like functions in the math class:

f(x) = x+1

is the same as:

lambda x: x + 1

No comments: