I start out with a small code example right away:
def foo():
    return 0
a = [1, 2, 3]
for el in a:
    el = foo()
print(a) # [1, 2, 3]
I would like to know what el is in this case. As a remains the same, I intuite that el is a reference to an int. But after reassigning it, el points to a new int object that has nothing to do with the list a anymore.
Please tell me, if I understand it correctly. Furthermore, how do you get around this pythonic-ly? is enumerate() the right call as
for i, el in enumerate(a):
    a[i] = foo()
works fine.
 
     
    