+ 1

Python function

What does lambda actually do !? I mean when should we use this !??

18th Feb 2021, 8:49 AM
mohammadali
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
18th Feb 2021, 9:06 AM
Slick
Slick - avatar
18th Feb 2021, 8:28 PM
mohammadali
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.).
19th Feb 2021, 10:44 AM
architux
architux - avatar