lambdak: multi-line lambda implementation in native Python

Gregory Ewing greg.ewing at
Fri Jan 16 22:29:47 CET 2015

Chris Angelico wrote:
> Is this to get
> around style guides that reject this kind of model:
> x = Foo(
>     opt1=True,
>     opt2=True,
>     color=Yellow,
> )

It's to get around the fact that you *can't* do that in
Java, because it doesn't have keyword arguments.

This is a source of a lot of the complexity and boilerplate
found in Java code -- the need to work around deficencies
in the language.

> But if you can
> pass a mapping object to the constructor, you can do the same job that
> way,

Yes, but constructing the mapping object is just as
tedious. :-(

> you could pass an array of
> item,value,item,value,item,value or something.

That's certainly possible, but then you have to write
tedious code in the constructor to parse the arguments,
you lose compile-time type safety, incur runtime
overhead, etc.

We're really quite spoiled in Python-land. It's easy
to forget just *how* spoiled we are until you go back
and try to do something in one of the more primitive


More information about the Python-list mailing list