---
# System prepended metadata

title: mutable & immutable

---

# mutable & immutable 

每個python的變數都有自己的id，reference 的概念，而變數的 assign 其實只常常只是copy reference，而非創建一個新的物件。


> Mutable objects can change their value but keep their id(). See also immutable.
> 



> immutable
> An object with a fixed value. Immutable objects include numbers, strings and tuples. Such an object cannot be altered. A new object has to be created if a different value has to be stored. They play an important role in places where a constant hash value is needed, for example as a key in a dictionary.