title: Subtracting two lists in Python
body: <p>In Python, How can one subtract two non-unique, unordered lists? Say we have <code>a = [0,1,2,1,0]</code> and <code>b = [0, 1, 1]</code> I'd like to do something like <code>c = a - b</code> and have <code>c</code> be <code>[2, 0]</code> or <code>[0, 2]</code> order doesn't matter to me. This should throw an exception if a does not contain all elements in b.</p>
  
  <p><strong>Note this is different from sets!</strong> I'm not interested in finding the difference of the sets of elements in a and b, I'm interested in the difference between the actual collections of elements in a and b.</p>
  
  <p>I can do this with a for loop, looking up the first element of b in a and then removing the element from b and from a, etc. But this doesn't appeal to me, it would be very inefficient (order of <code>O(n^2)</code> time) while it should be no problem to do this in <code>O(n log n)</code> time.</p>