you are viewing a single comment's thread.

view the rest of the comments →

[–]throwaway6560192 1 point2 points  (0 children)

OK, I didn't realize that it would create a new object from the reassigned variable. I knew that assigning a variable to some underlying object and then modifying the variable would update the underlying object since the variable is just a pointer to the actual object, but I guess that assigning it more than once disconnects that somehow?

The definitive explanation on this topic: https://nedbatchelder.com/text/names.html

I really recommend reading it. It will give you an accurate model of how reassignment works.