title: Why does my while-loop condition variable get mutated without assigning to it?
body: <p>I have the following neverending while-loop:</p>
  
  <pre><code>i = len(taglist) - 1
  while(i &gt;= 0):
      print("i, at the beginning: " + str(i))
      tag = taglist[i]
      label = tag["tagname"]
      merged_polygon = tag["polygon"]
      merged_indices = [i]
      print("i, a little further: " + str(i))
      for j in range(i * num_passes):
          print("i, in the for-loop: " + str(i))
          if taglist[j % i]["tagname"] == label and len(intersect(taglist[j % i]["polygon"], merged_polygon)) &gt; 0:
              merged_polygon = unite(taglist[j % i]["polygon"], merged_polygon)
              merged_indices.append(j)
              print("i, at the end of the for-loop: " + str(i))
      taglist = [t for i, t in enumerate(taglist) if i not in merged_indices]
      print("i, after the for-loop: " + str(i))
      tag["polygon"] = merged_polygon
      tag["bbox"] = bound_box(merged_polygon)
      taglist.append(tag)
      print("i, before update: " + str(i))
      i = min([i - 1, len(taglist) - 2])
      print("i, after update: " + str(i))
  </code></pre>
  
  <p>This results in the following results being printed over and over again:</p>
  
  <pre><code>...
  i, at the beginning: 1
  i, a little further: 1
  i, in the for-loop: 1
  i, in the for-loop: 1
  i, in the for-loop: 1
  i, in the for-loop: 1
  i, in the for-loop: 1
  i, after the for-loop: 2
  i, before update: 2
  i, after update: 1
  ...
  </code></pre>
  
  <p>My while-loop condition variable (<code>i</code>) is being incremented after the nested for-loop without my doing so. Why is this? I exclusively want to alter <code>ì</code> at the end of the while-loop.</p>