<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><br>
</p>
<br>
<div class="moz-cite-prefix">On 22/01/17 10:03 PM, Wes Turner wrote:<br>
</div>
<blockquote
cite="mid:CACfEFw8tifPGsVDd=RXg+bhoz_w4TcYdhcfgoRjL4n6wTUahiw@mail.gmail.com"
type="cite"><br>
<br>
On Sunday, January 22, 2017, Wes Turner <<a
moz-do-not-send="true" href="mailto:wes.turner@gmail.com">wes.turner@gmail.com</a>>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Have you
looked at pyrsistent for immutable/functional/<wbr>persistent/copy-on-write
data structures in Python?
<div>
<div><br>
</div>
<div><a moz-do-not-send="true"
href="https://github.com/tobgu/pyrsistent/"
target="_blank">https://github.com/tobgu/<wbr>pyrsistent/</a></div>
<div><br>
</div>
<div>(freeze() / thaw())</div>
<div><br>
</div>
<div>... e.g. List and Dict NamedTuple values are not
immutable (because append() and update() still work)</div>
</div>
</blockquote>
<div><br>
</div>
<div>fn.py also has immutables:</div>
<div><a moz-do-not-send="true"
href="https://github.com/kachayev/fn.py/blob/master/README.rst#persistent-data-structures">https://github.com/kachayev/fn.py/blob/master/README.rst#persistent-data-structures</a><br>
</div>
</blockquote>
<br>
You seem to be thinking of "immutable object builder". Not "the
builder itself is immutable and operations on it create new
builders".<br>
<br>
<blockquote
cite="mid:CACfEFw8tifPGsVDd=RXg+bhoz_w4TcYdhcfgoRjL4n6wTUahiw@mail.gmail.com"
type="cite">
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div><br>
On Sunday, January 22, 2017, Soni L. <<a
moz-do-not-send="true"
href="javascript:_e(%7B%7D,'cvml','fakedme%2Bpy@gmail.com');"
target="_blank">fakedme+py@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">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:<br>
<br>
long_name = mkbuilder()<br>
long_name.seta(a)<br>
long_name.setb(b)<br>
y = long_name.build()<br>
<br>
Instead, you'd need something more like this:<br>
<br>
long_name = mkbuilder()<br>
long_name = long_name.seta(a)<br>
long_name = long_name.setb(b)<br>
y = long_name.build()<br>
<br>
Or we could add an operator to simplify it:<br>
<br>
long_name = mkbuilder()<br>
long_name .= seta(a)<br>
long_name .= setb(b)<br>
y = long_name.build()<br>
<br>
(Yes, I'm aware you can x = mkbuilder().seta(a).setb(b),
then y = x.build(). But that doesn't work if you wanna
"fork" the builder. Some builders, like a builder for
network connections of some sort, would work best if they
were immutable/forkable.)<br>
______________________________<wbr>_________________<br>
Python-ideas mailing list<br>
<a moz-do-not-send="true">Python-ideas@python.org</a><br>
<a moz-do-not-send="true"
href="https://mail.python.org/mailman/listinfo/python-ideas"
target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/python-ideas</a><br>
Code of Conduct: <a moz-do-not-send="true"
href="http://python.org/psf/codeofconduct/"
target="_blank">http://python.org/psf/codeofco<wbr>nduct/</a><br>
</blockquote>
</div>
</div>
</blockquote>
</blockquote>
<br>
</body>
</html>