lambdak: multi-line lambda implementation in native Python

Michael Torrie torriem at gmail.com
Fri Jan 16 17:23:11 CET 2015


On 01/15/2015 10:29 PM, Ian Kelly wrote:
> On Thu, Jan 15, 2015 at 9:00 PM, Chris Angelico <rosuav at gmail.com> wrote:
>> 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?
> 
> In Java you have to write a separate constructor for every conceivable
> combination of arguments. If there are a lot of optional arguments,
> that's an exponentially large number of constructors. The builder
> pattern provides a solution to that problem.
> 
> In Python you just have one initializer with defaults for the optional
> arguments, so it's not an issue.

Which seems to confirm my understanding that these patterns are in large
part a response to limitations in the language, which certainly doesn't
engender a fondness for the Java.




More information about the Python-list mailing list