N
Neal D. Becker
x = [1,2,3]
for i in x:
i = 2
This doesn't change x. 2 questions:
1) Why not? Why doesn't assign to an iterator of a mutable type change the
underlying object?
2) What is the preferred way to do this?
for i in x:
i = 2
This doesn't change x. 2 questions:
1) Why not? Why doesn't assign to an iterator of a mutable type change the
underlying object?
2) What is the preferred way to do this?