title: Ordered intersection of two lists in Python
body: <p>I know that in Python, if I have:</p>
  
  <pre><code>list_1 = [1,2,3]
  list_2 = [2,3,4]
  </code></pre>
  
  <p>I can do the following to find the intersection between the two:</p>
  
  <pre><code>list(set(list_1) &amp; set(list_2))
  # = [2,3]
  </code></pre>
  
  <p>But there's one problem with that approach: sets don't maintain order the way that lists do.  So if I actually have:</p>
  
  <pre><code>list_1 = [3,2,1]
  list_2 = [2,3,4]
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>list(set(list_1) &amp; set(list_2))
  # = [2,3]
  </code></pre>
  
  <p>even though I'd prefer to have the order from the first list, ie.:</p>
  
  <pre><code># = [3,2]
  </code></pre>
  
  <p>Is there an alternative intersection technique which keeps the resulting "intersection set" in the same order as the first list?</p>