Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
1 Responder
5114 Visualizações

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
Cancelar
Melhor resposta

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
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
0
mar. 25
1219
4
abr. 24
173889
0
dez. 23
1998
5
jul. 25
227238
1
dez. 22
3059