<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    On 13.05.2018 11:23, Peter O'Connor wrote:<br>
    <blockquote type="cite"
cite="mid:CACCbJKquJNPbz6oOeC7wfJt_pP0R_jEMTLh6SP-63hcVMooDGA@mail.gmail.com">
      <meta http-equiv="Context-Type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div> *Correction: Above code should read: </div>
        <span class="gmail-im">
          <div><br>
          </div>
          <div>    outputs = []</div>
          <div><span>   <span> </span></span>state = initial_state</div>
          <div><span>   <span> </span></span>for inp in inputs:</div>
          <div>   <span> </span><span>   <span> </span></span>out, state
            = my_update_func(inp, state)</div>
        </span>
        <div>   <span> </span><span>   <span> </span></span>outputs.append(out)</div>
        <br>
      </div>
    </blockquote>
    <br>
    Question still stands if this type of code needs compaction in the
    first place?<br>
    <br>
    List comprehensions usually have some sort of declarative touch (set
    builder notation).<br>
    <br>
    Even though, striving for a more compacted version, I tend to think
    that using a declarative version of it doesn't serve it well in the
    long term.<br>
    <br>
    <br>
    We recently came across the following code snippet in our source
    base (1st answer of <a moz-do-not-send="true"
href="https://stackoverflow.com/questions/480214/how-do-you-remove-duplicates-from-a-list-whilst-preserving-order">https://stackoverflow.com/questions/480214/how-do-you-remove-duplicates-from-a-list-whilst-preserving-order</a>).
    It was absolutely not comprehensible.<br>
    <br>
    <br>
    Your example is inherently imperative because the internal state
    changes from iteration to iteration; something unusual for set
    builder notation.<br>
    <br>
    <br>
    Regards,<br>
    Sven<br>
  </body>
</html>