For the object reference problem, has been the state of smattering, is now ready for use.
When you add and subtract operations to an immutable object, a new immutable instance is created in memory without affecting the original reference
>>> c=12
>>> D=c
>>> c+=1
>>> C
13
>>> D
12
>>>
>>> a= "345a"
>>> B=a
>>> a+= "Dfger"
>>> A
' 345adfger '
>>> b
' 345a '
>>> (a=)
>>> B=a
>>> b
(1, 2, 3)
>>> a= ' Wert '
>>> A
' Wert '
>>> b
(1, 2, 3)
>>>
When manipulating a Mutable object, the objects in memory change, affecting all references, and the difference from the previous case is that the original object is changed in memory when the object is altered or a new object is created.
>>> a=[1,2,3]
>>> B=a
>>> A.insert (0, "Ertwer")
>>> A
[' Ertwer ', 1, 2, 3]
>>> b
[' Ertwer ', 1, 2, 3]
>>>
>>> a={1:2, ' a ': ' B ', ' 4 ': 5464}
>>> B=a
>>> a["678"]= "F**k"
>>> A
{' A ': ' B ', 1:2, ' 678 ': ' F**k ', ' 4 ': 5464}
>>> b
{' A ': ' B ', 1:2, ' 678 ': ' F**k ', ' 4 ': 5464}
>>>
The crux of the problem is whether the object is mutable. In contrast, the immutable object in Python is only numbers, strings, tuples, frozensets Four, changing one of the references, without affecting other references; other list, dict, and both of the subclass objects , all belong to mutable, change any reference, and all other references will be affected.
Summary of Python object reference issues