Mega Code Archive

 
Categories / Python / Function
 

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)