r/Python • Python Morsels • Sep 27 '18

Stop writing lambda expressions in Python

http://treyhunner.com/2018/09/stop-writing-lambda-expressions/
0 Upvotes

26 comments sorted by

View all comments

1

u/galuszkak Sep 28 '18

I overall agree with Trey Hunner, but I think the root of problem is that, we don't think what we can do to improve lambdas.

One of the pain point of Python lambdas is that they are single line thing. It's bad in my view (I know author said that this doesn't matter to him). I just love lambdas construct in kotlin. They are supper elegant, easy and having default parameter it is so convenient so constructs like ints.filter { it > 0 } are so much more readable, short and easy to understand.

Maybe we should revise lambda syntax and propose PEP which is less verbose and more elastic? Kotlin got it just more than right and I would just love to have similar syntax in Python, I have some concepts in my mind's, but maybe some people have better ideas?

Overall experience to use more functional oriented paradigm in Python would be improved a lot.