Define function in Lambda Forms : lambda function : Function : Python examples (example source code) Organized by topic

C++
PHP
Python
Python Home »  Function   » [  lambda function  ]  Screenshots 
 



Define function in Lambda Forms





# With the lambda keyword, small anonymous functions can be created. 


def make_incrementor(n):
     return lambda x: x + n

f = make_incrementor(42)

print f(0)

print f(1)


           
       
Related examples in the same category
1.  lambda function definition with default value lambda function definition with default value
2.  Difference between a normal function and a lambda function Difference between a normal function and a lambda function
3.  Use lambda to define simple function Use lambda to define simple function
4.  Define lambda function inside another function Define lambda function inside another function
























Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.