A replacement for lambda

Paul Rubin http
Sat Jul 30 05:17:12 EDT 2005


Stefan Rank <stefan.rank at ofai.at> writes:
> I am sorry if this has already been proposed (I am sure it has).
> Why not substitue python-lambdas with degenerated generator expressions::
> 
>    (lambda x: func(x)) == (func(x) for x)

I don't think I've seen that one before, and FWIW it's kind of cute.

But what's wrong with leaving lambdas the way they are?  Anyone who can
understand generator expressions can understand lambda.  I don't see any
point in trying to improve on lambda, without actually fixing its main
problem, which is the inability to create multi-statement closures.



More information about the Python-list mailing list