Skip to Content
Menu
This question has been flagged
1 Reply
5105 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
0
Mar 25
1187
4
Apr 24
173806
0
Dec 23
1971
5
Jul 25
226999
1
Dec 22
3021