lambdak: multi-line lambda implementation in native Python

Chris Angelico rosuav at
Fri Jan 16 05:00:12 CET 2015

On Fri, Jan 16, 2015 at 12:44 PM, Michael Torrie <torriem at> wrote:
> On 01/15/2015 06:34 PM, Roy Smith wrote:
>> The ebb and flow of technology has recently brought me someplace I never
>> thought I'd be.  Java-land.  And what I've discovered is that factories
>> are so last year.  Apparently builders are the new thing.
> It's never clear to me whether all these fancy design patterns are to
> make up for a deficient language, or whether some people just get their
> kicks from layer upon layer of abstraction.  Certainly it's this sort of
> thing that turns me right off of Java.

My first response was going to be "Well, you can always add another
layer of indirection to try to solve your problem", but then I went
and looked up builders on Wikipedia. Now I'm confused. What can you do
with a builder that you can't do with a constructor? Is this to get
around style guides that reject this kind of model:

x = Foo(

so you instead do this?

x = Foo.Builder()
x.opt1 = True
x.opt2 = True
x.color = Yellow
x = x.get()

How is that an improvement?

In Python, of course, keyword arguments do this job brilliantly, but
I'm aware that not all languages support them. Okay. But if you can
pass a mapping object to the constructor, you can do the same job that
way, and even if you can't do that, you could pass an array of
item,value,item,value,item,value or something. Surely there must be
some way that would work.


More information about the Python-list mailing list