Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
5115 Vistas

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
Descartar
Mejor respuesta

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
0
mar 25
1221
4
abr 24
173890
0
dic 23
1998
5
jul 25
227249
1
dic 22
3060