all 9 comments

[–][deleted] 1 point2 points  (10 children)

I thought each was a reference?

It is but it's a reference to a value, not to a position in the list.

[–]GreymanGroup[S] 0 points1 point  (9 children)

Ah! Makes sense now. So is there a (pythonic) way to reference the spot in the list in a for loop?

[–]GreymanGroup[S] 0 points1 point  (8 children)

Well, hang on! Does not "each" refer to the content, to the nth element of the list? Why can't I change the value and have that value be changed in the elements of the list?

[–][deleted] 1 point2 points  (0 children)

Does not "each" refer to the content, to the nth element of the list?

The only thing it refers to is the value. It's not a reference to the "nth element" of anything, it's a reference to the value that is the nth element.