Skip to Content
Menu
This question has been flagged
1 Reply
4530 Views

I have started learning to develop for Odoo modules under Python language. I have been looking source code examples over internet and try to learn by my own. I have been going through a Python code and am unable to understand use of lambda. 

Hope Suggestions !


Avatar
Discard
Best Answer

Hi Vineeth ,

Lambda's form a very convenient short-cut notation for defining
functions on the fly - especially when you wish to pass them to
functions. For example:

map(lambda x:x*x, [1,2,3])

Is far more convenient than first defining a "sqr" function and then
calling map with sqr as parameter. Also, when you code in a functional
style, you will make very heavy use of "little" functions for the
purpose of passing them onto some other function - it doesn't make
sense to define all these little functions by name ..

Avatar
Discard
Related Posts Replies Views Activity
4
Apr 24
170716
0
Dec 23
599
5
Nov 24
217098
1
Dec 22
1692
2
Nov 22
1676