##########################
The lambda operator or lambda function is a way to create small anonymous functions, i.e. functions without a name. These functions are throw-away functions, i.e. they are just needed where they have been created. Lambda functions are mainly used in combination with the functions filter(), map() and reduce(). The lambda feature was added to Python due to the demand from Lisp programmers.
f = lambda x, y : x + y
f(1,1)
----------
>>> def f (x): return x**2
...
>>> print f(8)
64
>>>
>>> g = lambda x: x**2
>>>
>>> print g(8)
64
--------------
f=lamda x,y:x+y
print(f(a,b))
------------
f=lamda a: lamda b: lamds c: a+b+c
f(2)(3)(4)
---------
f= lamda c: lamda a,b: lamd d:(c*(a+b))%d)
print(f(2)(4,3)(11))
No comments:
Post a Comment