[Tutor] Lambda

Andy W toodles@yifan.net
Tue, 5 Feb 2002 14:50:01 +0800


> add =
> lambda x,y:                                      x+y
> ^^
> ^^                                       ^^
> variable name which will
> arguments to pass in             the expression to be evaluated and
returned
> now refer to the function

Ew, it got all squashed.

> add = lambda x,y: x+y

add =
^^ variable name which will  now refer to the function

lambda
^^ keyword...

x,y:
^^ arguments to be passed in

x+y
^^ expression to be evaluated and returned