R. David Murray added the comment:
Yep, that's the way Python works. You are modifying the same object through
different names. Remember that in Python it is the objects that matter (which
are identified in CPython via their memory address, but that's an
implementation detail) and names are
New submission from 64andy <64andy2...@gmail.com>:
If multiple lists/dictionaries are in the same memory address (usually caused
by var1 = var2), then altering one will effect every variable in that address.
The ways I've found to achieve this are:
>>> my_list[2] = "Spam"
>>> my_list += "9"
>>>