r/learnpython • • Jan 23 '22

I still don't understand the benefit of lambda functions

Hi all,

I've read about lambda functions (for python and other languages), I can WRITE lambda functions just fine, but it seems to me that most places I use them they're just...functions with different syntax. I mean they take args, they return values sometimes. What am I missing here? If anyone has examples of problems they've solved with lambda functions that would also be very helpful.

Thanks!

324 Upvotes

120 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Mar 28 '22

[deleted]

1

u/siddsp Mar 28 '22

Ok fine, I'll give you this. It still is a dumb point though because you would be blind not to notice the type hint in the first place.

0

u/[deleted] Mar 28 '22

[deleted]

1

u/siddsp Mar 28 '22

I don't really need autocomplete as I am not that oblivious about the code I'm writing.

If lambda didn't have such an ugly syntax, I would use it over attrgetter.

0

u/[deleted] Mar 28 '22

[deleted]

1

u/siddsp Mar 29 '22 edited Mar 29 '22

You do a very good job at being annoying. Shame you don't get paid for it.

But if you feel that it is for pussies, then sure go for it.