[Python-ideas] "Immutable Builder" Pattern and Operator
Steven D'Aprano
steve at pearwood.info
Mon Jan 23 08:54:19 EST 2017
On Mon, Jan 23, 2017 at 12:49:19AM -0200, Soni L. wrote:
[...]
> You seem to be thinking of "immutable object builder". Not "the builder
> itself is immutable and operations on it create new builders".
Why would you make a builder class immutable?
That's not a rhetorical question -- I'm genuinely surprised that you're
not only using the builder design pattern (there are usually better
solutions in Python) but more so that you're making the builder itself
immutable.
In any case, it seems that this is such a narrow and unusual use-case
that it wouldn't be wise to give it special syntax. Especially when
there are other, potentially far more useful, uses for the .= syntax,
e.g. Julia's syntactic loop fusion:
http://julialang.org/blog/2017/01/moredots
--
Steve
More information about the Python-ideas
mailing list