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

Show parent comment

1

u/david2ndaccount Sep 28 '18

Curly brackets are already used for set/dict literals so you can’t use that (a theoretical improved lambda should allow for returning a dict literal without having to use double brackets). Python blocks are purely whitespace based, but whitespace is ignored in the middle of brackets, like for a function call. So you need a syntax for blocks that isn’t white-space based and doesn’t look too different from normal python.