Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
5113 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
bře 25
1214
4
dub 24
173877
0
pro 23
1993
5
čvc 25
227220
1
pro 22
3056