Why Does Python Script Jump Over Some Entries And Not Others?
<p>In a Python list, an entry I expected to be removed remained, and another entry was removed. Why is that?</p>

<p>Here's the problematic code:</p>

<pre><code>def getAdjacent(pos, bounds):
    posibles = [
    [pos[0]-1, pos[1]],
    [pos[0]+1, pos[1]],
    [pos[0], pos[1]-1],
    [pos[0], pos[1]+1]]
    for p in posibles:
        if isOutside(p,bounds):
            posibles.remove(p)
    return posibles


def isOutside(pos, bounds):
    if pos[0] &gt; bounds[0]-1 or pos[0] &lt; 0 or pos[1] &lt; 0 or pos[1] &gt; bounds[1]-1:
        return True
    else:
        return False
</code></pre>

<p>Here's some Inputs and outputs that reflect the problem:</p>

<pre><code>In [13]: bounds = [10, 10]

In [14]: p = [9,0]

In [15]: getAdjacent(p, bounds)
Out[15]: [[8, 0], [9, -1], [9, 1]]

In [16]: isOutside([9, -1], bounds)
Out[16]: True

In [17]: isOutside([9, 1], bounds)
Out[17]: False
</code></pre>

<p>Now why is [9, -1] still in getAdjacent() when getAdjacent() removes all elements that cause isOutside() to retrun True? And why isn't [10, 0] still in there? Is it a magnitude thing?</p>
