可更改(mutable)对象与不可更改(immutable)对象

str, tuple, 和number是不可更改的对象,

list,dict等则是可以修改的对象。


example




python - python函数的参数传递是传值还是传引用?_编程




结论

  1. mutable 变量,传址
  2. immutable 变量,传值