I am new to Python (and dont know much about programming anyway), but I remember reading that python generally does not copy values so any statement a = b makes b point to a
When you execute b = a
, it makes b refer to the same value a refers to. Then when you execute a = 2
, it makes a refer to a new value. b is unaffected.
The rules about assignment in Python:
Assignment simply makes the name refer to the value.
Assignment to a name never affects other names that refer to the old value.
Data is never copied implicitly.