This is easy to do in Python, and we already have NamedTuples and
other things.
If you need such a builder anyway, this snippet can work - no need for
special syntax:
https://gist.github.com/jsbueno/b2b5f5c06caa915c451253bb4f171ee9
On 22 January 2017 at 20:54, Serhiy Storchaka <storchaka at gmail.com> wrote:
> On 23.01.17 00:45, Soni L. wrote:
>>>> I've been thinking of an Immutable Builder pattern and an operator to go
>> with it. Since the builder would be immutable, this wouldn't work:
>>>> long_name = mkbuilder()
>> long_name.seta(a)
>> long_name.setb(b)
>> y = long_name.build()
>>> I think the more pythonic way is:
>> y = build(a=a, b=b)
>> A Builder pattern is less used in Python due to the support of keyword
> arguments.
>>>> _______________________________________________
> Python-ideas mailing list
>Python-ideas at python.org>https://mail.python.org/mailman/listinfo/python-ideas> Code of Conduct: http://python.org/psf/codeofconduct/