元组是不可变的,但是最终我们修改了元组中的元素。尽量不要把可变对象放到元组中
t=(1,2,[10,20])
t
(1, 2, [10, 20])
t[2]+=[30,40]
Traceback (most recent call last):
File "<input>", line 1, in <module>
TypeError: 'tuple' object does not support item assignment
t
(1, 2, [10, 20, 30, 40])
原因待后续分析