title: Python: remove elements of a list satisfying a condition
body: <p>Given a Python list, I'd like to remove "bad" elements. For example, given a list of lists of integers, I'd like to remove lists beginning with a negative integer. Here's an attempt and failure:</p>
  
  <pre><code>S=[[1,1],[2,1],[-1,1],[-2,1]]
  
  for s in S:    
      if s[0]&lt;0:
          S.remove(s)
  </code></pre>
  
  <p>which returns</p>
  
  <pre><code>[[1, 1], [2, 1], [-2, 1]]
  </code></pre>
  
  <p>I'd like to know why the above code doesn't work as expected (it would be instructive), as well as the right way to do this. (I know that I can create a new list where I add those lists of S with positive first element, but I'd rather not make a new list unless necessary.)</p>