Of what use is 'lambda'???

Tim Dixon tdixon at linux.the-dixons.net
Mon Sep 18 23:08:42 EDT 2000


On Mon, 18 Sep 2000 18:43:27 -0700, tye4 posted:
>
>The lambda definition is limited to only one expression, and everything
>you do with lambda, can also be done with plain functions.
>
>>>> adder1 = lamda a, b : a + b
>>>> def dosum(a, b):
>        return a + b
>
>>>> adder2 = dosum
>
>>>> adder1(2, 3)
>5
>
>>>> adder2(2, 3)
>5
>
>So, does lamda have a feature that regulars funcs have or is just there
>for convenience??
>
>-tye4
>

Just a convenience: it lets you do function-like stuff without having to
create and name a function.  Lisp people (and its derivatives, from RPL to
Logo to ....) will find it a familiar concept.

-- 

Tim Dixon   tdixon at the-dixons.net http://www.the-dixons.net



More information about the Python-list mailing list