<br><br>On Sunday, January 22, 2017, Soni L. <<a href="mailto:fakedme%2Bpy@gmail.com">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">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <p><br>
    </p>
    <br>
    <div>On 22/01/17 10:03 PM, Wes Turner wrote:<br>
    </div>
    <blockquote type="cite"><br>
      <br>
      On Sunday, January 22, 2017, Wes Turner <<a href="javascript:_e(%7B%7D,'cvml','wes.turner@gmail.com');" target="_blank">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/persisten<wbr>t/copy-on-write
        data structures in Python?
        <div>
          <div><br>
          </div>
          <div><a href="https://github.com/tobgu/pyrsistent/" target="_blank">https://github.com/tobgu/pyrsi<wbr>stent/</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 href="https://github.com/kachayev/fn.py/blob/master/README.rst#persistent-data-structures" target="_blank">https://github.com/kachayev/<wbr>fn.py/blob/master/README.rst#<wbr>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".</div></blockquote><div><br></div><div>My mistake.</div><div>Something like @optionable and/or @curried from fn.py in conjunction with PClass from pyrsistent may accomplish what you describe?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF"><br>
    <br>
    <blockquote 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>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>Python-ideas@python.org</a><br>
              <a 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 href="http://python.org/psf/codeofconduct/" target="_blank">http://python.org/psf/codeofco<wbr>nduct/</a><br>
            </blockquote>
          </div>
        </div>
      </blockquote>
    </blockquote>
    </div></blockquote><div> <br></div>