lambda expressions

Martin von Loewis loewis at informatik.hu-berlin.de
Sun Feb 3 09:35:37 EST 2002


Bas van Gils <bas.vangils at home.nl> writes:

> I've been wondering, lately, about lambda-expressions. Most programming
> languages support and I wondered why (mostly because I find them hard to
> read, valueing _readable_ code). Collegues at work couldn't give me a
> satisfying answer so ... can anyone explain to me why lambda-expressions
> are so useful?

I think they got introduced because some people found them convenient,
especially those coming from a functional background. To them, it is a
religious matter: If you have map and filter, you also ought to have
lamba.

Later, they found that, even though they got what they asked for, they
did not get what they wanted: inside a lambda expression, you can only
use expressions, but they also wanted anonymous code blocks.

It is unlikely that they will ever get that, since nested functions
can now refer to local variables conveniently.

Regards,
Martin



More information about the Python-list mailing list