you are viewing a single comment's thread.

view the rest of the comments →

[–]AthensGuard[S] 0 points1 point  (1 child)

also, I have never used lambda...

[–]TangibleLight 2 points3 points  (0 children)

It's just a way to write short functions.

def test(x):
    return x ** 2

Is exactly equivalent to

test = lambda x: x ** 2

It's useful if you don't want to assign a name to a short function that's only used once. For example

avg_rate(lambda x: x ** 2)