[Python-ideas] Thoughts on lambda expressions
Abe Dillon
abedillon at gmail.com
Wed Mar 2 21:44:33 EST 2016
On Wednesday, March 2, 2016 at 7:25:24 PM UTC-6, Ethan Furman wrote:
>
> > but the lambda version is also
> > horrid which is exacerbated by the fact that it looks like your trying
> > to give the function a name or otherwise store it which defeats whole
> > purpose of a lambda.
>
> If I was giving it a name I would use `def`. I am storing it, and that
> is a very common use of lambdas (to be fair, I stole one line from a
> multi-line dictionary definition).
>
> > At that point just use 'def' and stop trying to use
> > lambda where it is ill suited.
>
> This is exactly where lambda is suited.
>
>
You're right. I'm sorry for getting uppity. I was thinking of the problems
that arise when you try to store generators (not lambdas *brain fart*)
instead of using them in situ. Whenever I've tried to store generators, it
has lead to pain and suffering because they are ephemeral creatures.
Lambdas, obviously are not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160302/26b5cf58/attachment.html>
More information about the Python-ideas
mailing list