I'd run on a subtle bug on an involved python script. Basically what went wrong looks like this
def inc(x):
return x+1
a = 1
b = 2
c = 3
for x in [a,b]:
print(id(x), id(a), id(b))
for x in [a,b]:
x = inc(x)
c = inc(c)
print(a,b,c)
As the first for loops shows the iterator x is taking a reference to the ongoing variable. Still when we assign a value to that iterator, the pointee(referencee) variable is not changing. I really didn't expect that behavior, this is not python, isn't? Can some one throw some light on this?