On 01/15/2015 10:29 PM, Ian Kelly wrote:
> On Thu, Jan 15, 2015 at 9:00 PM, Chris Angelico <ros...@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.

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to