Hacker News new | ask | show | jobs
by wavemode 654 days ago
> Python refuses to implement proper lambdas

Python has lambdas. What do you mean by "proper" lambdas?

2 comments

Lambdas 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.

Multi-line without ugly “lambda” keyword.