+ 1
Python function
What does lambda actually do !? I mean when should we use this !??
3 odpowiedzi
+ 1
lambda is a "function on the fly". Think of it as a quick function you'll probably only use once.
Honestly, I never use them. If i want a function, i'll write a function. And if I'll only use some code once, then i'll just write the code out for readability. seems helpful with obfuscation
0
Slick Dipanshu Kubde thank you
0
Lambdas are anonymous or inline functions to be used when you have to run some simple one-line operation on-the-fly. I have never used ones, 'cause it's more ideamatic and reasonable to use some other functions in such cases (map, filter, reduce, sorting collections with itertools module, various comprehensions, etc.).