title: Python: Delete all list indices meeting a certain condition
body: <p>to get right down to it, I'm trying to iterate through a list of coordinate pairs in python and delete all cases where one of the coordinates is negative. For example: </p>
  
  <p>in the array: </p>
  
  <pre><code>map = [[-1, 2], [5, -3], [2, 3], [1, -1], [7, 1]]
  </code></pre>
  
  <p>I want to remove all the pairs in which either coordinate is &lt; 0, leaving:</p>
  
  <pre><code>map = [[2, 3], [7, 1]]
  </code></pre>
  
  <p>My problem is that python lists cannot have any gaps, so if I loop like this:</p>
  
  <pre><code>i = 0
  for pair in map:
          for coord in pair:
              if coord &lt; 0:
                  del map[i]
      i += 1
  </code></pre>
  
  <p>All the indices shift when the element is deleted, messing up the iteration and causing all sorts of problems. I've tried storing the indices of the bad elements in another list and then looping through and deleting those elements, but I have the same problem: once one is gone, the whole list shifts and indices are no longer accurate.</p>
  
  <p>Is there something I'm missing? </p>
  
  <p>Thanks. </p>