Why use lambda when you can use list comprehension? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why use lambda when you can use list comprehension?

2nd Jun 2018, 2:55 AM
Chris Sheffield
Chris Sheffield - avatar
5 Answers
+ 5
Lambda allows you to pass a function as an argument for another function these are known as anonymous functions rather than writing a too long code https://code.sololearn.com/c9lwxKCrkqBc/?ref=app
2nd Jun 2018, 3:28 AM
Scorpia Rising🎩
Scorpia Rising🎩 - avatar
+ 5
See the effect on time when adding lambdas to map and filter as oposed to listcomp https://code.sololearn.com/caVGRw4he3EQ/?ref=app
2nd Jun 2018, 5:13 AM
Louis
Louis - avatar
+ 1
Ahhh i see
2nd Jun 2018, 3:52 AM
Chris Sheffield
Chris Sheffield - avatar
+ 1
Very well explained thank you
2nd Jun 2018, 3:52 AM
Chris Sheffield
Chris Sheffield - avatar
+ 1
But lambda kind of make thr code difficult to read
18th Jun 2018, 5:29 PM
Shayan
Shayan - avatar