3 ms·
I don't think Python is ever going to get multi-line/fully-featured/less-ugly lambdas.
by Kwpolska 4y ago
I don't think Python is ever going to get multi-line/fully-featured/less-ugly lambdas.
- dragonwriter 4y agoVery many languages only have single-expression lambdas, Python isn’t unusual in that, its just that nontrivial single expressions in Python are extremely ugly (to the point where most people think they are much more limited than they are.) The lambda issue in Python isn’t really about lambdas, but the readability and expressiveness of expressions.
- pharmakom 4y agoPython would be so much better if it was expression orientated. I don’t think it would even detract from Pythons design goals at all.
- dragonwriter 4y agoI agree, but given the Zen and the disruption when print moved to a function from a statement, I don’t see a good evolution path to get much closer. OTOH, small improvements in what can cleanly be expressed in an expression could still have big payoffs for Python.
- erik_seaberg 4y agoImporting from __future__ worked well to make language changes opt-in. It was a mistake to start breaking backward compatibility by default.
- Kwpolska 4y ago> Very many languages only have single-expression lambdas Which languages are those? Java, C#, C++, Rust, JS, Swift, Kotlin, Scala, Ruby, PHP, and Go all allow defining multi-line anonymous functions that can contain any statement normally allowed in a function.