You code looks weird. You store the looping number into idx[0]
that way - you can see that by printing it:
idx = [0,0,0]
junk = [1, 2, 3, 4, 5,6]
for idx[0] in junk:
print(idx[0], idx)
to get
1 [1, 0, 0]
2 [2, 0, 0]
3 [3, 0, 0]
4 [4, 0, 0]
5 [5, 0, 0]
6 [6, 0, 0]
So you are activly changing the value of idx[0]
on each iteration - how many iterations are done is ruled by junk
's values.
You can create a "creative/inefficient" list-copy by that:
junk = [1, 2, 3, 4, 5,6]
idx = [0] * len(junk)
for i,idx[i] in enumerate(junk):
pass
although I have no clue whatfor one would need that :D