4 ms·
> Python refuses to implement proper lambdas Python has lambdas. What do you mean by "proper" lambdas?
by wavemode 2y ago
> Python refuses to implement proper lambdas
Python has lambdas. What do you mean by "proper" lambdas?
- lolinder 2y agoLambdas in Python are intentionally second class citizens in that they cannot be full blocks, only a single expression. Technically there's a workaround in that you can define a named function and then refer to it later, but that's enough of a hassle that using lambdas in method calls is much less common in Python than it is in Kotlin. In Kotlin, much of what would normally be special syntax structures are just function calls that get passed a lambda. That's not possible with Python's single-expression lambda functions, so you get special syntax instead for things like comprehensions.
- wiseowise 2y agoMulti-line without ugly “lambda” keyword.