title: Dynamic self-referencing conditional in list comprehension
body: <p><strong>Goal</strong>: Create a conditional statement in a list comprehension that (1) <em>dynamically</em> tests -- i.e., upon each iteration -- if the element is not in the list being comprehended given (2) the list is itself updated on each iteration.</p>
  
  <p><strong>Background code:</strong></p>
  
  <pre><code>arr = [2, 2, 4]
  l = list()
  </code></pre>
  
  <p><strong>Desired output:</strong></p>
  
  <pre><code>l = [2, 4]
  </code></pre>
  
  <p><strong>Desired behavior via for loop:</strong></p>
  
  <pre><code>for element in arr:
          if element not in l:
              l.append(element)
  </code></pre>
  
  <p><strong>Incorrect list comprehension <em>not</em> generating desired behavior:</strong></p>
  
  <pre><code>l = [element for element in arr if element not in l]
  </code></pre>
  
  <p><strong>Question restated</strong>: How do I fix the list comprehension so that it generates the desired behavior, i.e., the desired output stated above?</p>