2 ms·
I wish python would support multi line lambdas. Having to define a separate function often makes thing considerably less readable in my experience.
by nicoburns 4y ago
I wish python would support multi line lambdas. Having to define a separate function often makes thing considerably less readable in my experience.
- version_five 4y agoSee below. Not very satisfying, but a lot of though has gone on around it: https://stackoverflow.com/questions/1233448/no-multiline-lambda-in-python-why-not https://stackoverflow.com/questions/1233448/no-multiline-lam...
- nopenopenopeno 4y agoPython supports multi-line lambdas (use parentheses). However, it does not support lambda functions. Python lambdas can only be expressions.
- epx 4y agoI am not fan of Ruby but this is a thing that Ruby nailed on (blocks).
- dragonwriter 4y ago> I wish python would support multi line lambdas It does, it just doesn’t support statements (not even one) in lambdas, since a lambda (however many lines it takes up) contains a single expression.
- raymondh 4y agoIt does. Just add parentheses.