可变对象与不可变对象
可变对象是指,一个对象在不改变其所指向的地址的前提下,可以修改其所指向的地址中的值; 值和地址不对应(列表)
不可变对象是指,一个对象所指向的地址上值是不能修改的,如果你修改了这个对象的值...a_list = [1, 2, 3]
a_shallow_list = copy.copy(a_list)
a_deep_list = copy.deepcopy(a_list)
print("id of...a_tuple = (1, 2, 3)
a_shallow_tuple = copy.copy(a_tuple)
a_deep_tuple = copy.deepcopy(a_tuple)
# 比较基本不可变对象...a1_tuple = (1, 2, (1, 2, 3), [1, 2, 3])
a1_shallow_tuple = copy.copy(a1_tuple)
a1_deep_tuple = copy.deepcopy...a1_list = [1, 2, (1, 2, 3), [1, 2, 3]]
a1_shallow_list = copy.copy(a1_list)
a1_deep_list = copy.deepcopy