lambdak: multi-line lambda implementation in native Python

Yawar Amin yawar.amin at gmail.com
Fri Jan 16 04:20:02 CET 2015


On Thursday, January 15, 2015 at 10:06:34 PM UTC-5, Rick Johnson wrote:
> [...]
> Well i'm not religious in that way, but i can tell you that
> you'd be hard pressed to find a subject that did *NOT*
> annoy someone in this group. Heck, it might even be
> something like finding a "holy grail" if we all agreed!

Ha! Indeed. And here I was thinking that Python's Holy Grail would be
finding a good multi-line lambda :-)

> Oh my, that's atrocious! (but kudos for trying!). If you
> have not already done so, i would suggest you play around
> with the Ruby language -- for which anonymous blocks are
> quite prevalent.

Yes, I've been very impressed by Ruby's æsthetics. Matz did something
with Ruby that few other people were willing to do: he followed
expression semantics to its logical conclusion. People (including
myself) have asked if we could have that in Python, but as I understand
it Python has some strict newline and indent requirements that prevent
it.

> I myself have lamented the limited power and expressiveness
> of Python's anonymous functions. It's almost as though
> Python lambda's are barely worth having since they are so
> crippled.

I guess they are crippled from the perspective of a functional
programmer. But they work pretty well for their intended uses. And as I
mentioned, if your editor masks the keyword and displays the symbol,
they almost look natural in the code.

Regards,

Yawar



More information about the Python-list mailing list