Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
5109 Представления

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 !


Аватар
Отменить
Лучший ответ

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 ..

Аватар
Отменить
Related Posts Ответы Просмотры Активность
0
мар. 25
1201
4
апр. 24
173856
0
дек. 23
1986
5
июл. 25
227134
1
дек. 22
3045