Re:SICP: JavaScript Edition available for pre-order
by wallscratch on Friday January 21, 2022 @01:00AM
(#30019750)
What’s awkward about lambda in python?
[ Parent
| on HN ]
Re:SICP: JavaScript Edition available for pre-order
by senkora on Friday January 21, 2022 @02:10AM
(#30020196)
Python is based on mainly on statements rather than expressions, and lambdas can’t have multiple statements, so writing lambdas is different from writing normal Python code.
In a very real sense, there is no idiomatic way to write complex lambdas in Python. What you would do instead is define a named function and pass it in as an argument. This is fine but definitely more complicated.