Change next list element during iteration?
<p>Imagine you have a list of points in the 2D-space. I am trying to find symmetric points.</p>

<p>For doing that I iterate over my list of points and apply symmetry operations. So suppose I apply one of these operations to the first point and after this operation it is equal to other point in the list. These 2 points are symmetric.</p>

<p>So what I want is to erase this other point from the list that I am iterating so in this way my iterating variable say "i" won't take this value. Because I already know that it is symmetric with the first point.</p>

<p>I have seen similar Posts but they remove a value in the list that they have already taken. What I want is to remove subsequent values.</p>

<p>Whatever symmetric points turn out to be True add them to a set, since set maintains unique elements and look up is <code>O(1)</code> you can use if <code>point not in set</code> condition. </p>

<pre><code>if point not in s:
    #test for symmetry
    if symmetric:
        s.add(point)
</code></pre>

python python-2.7 loops iterator