define
An anonymous function refers to a class of functions or subroutines that do not require an identifier to be defined.Python defines anonymous functions using the lambda syntax, which requires only an expression and not an assertion.
The lambda syntax is defined as follows:
lambda [arg1 [,arg2, ... argN]] : expression
An anonymous function is a function without an actual name. Its body is simply an expression without the use of a code block.
<function object name> = lambda <formal parameter list>: <expression>
Example:
def add(x,y): return x+y
Can be defined as an anonymous function: func=lambda x,y:x+y
Function object names can be called directly as functions:
It can also be called directly: (lambda x,y:x*y)(2,2)