Python notes: mutable and immutable

1. Objects are Python's abstraction for data.
2. Every object has an identity, a type and a value.
3. identity: is, id().
4. type() returns an object's type.
5. Objects whose value can change are said to be mutable.
6. Objects whose value is unchangeable once they are created are called immutable.
7. The value of an immutable container object that contains a reference to a
mutable object can change when the later's value is changed.
8. Numbers, strings and tuples are immutable, while dictionaries and lists are
mutable.

Python passes references-to-objects by value.
For detail, see pass by value

你可能感兴趣的:(Python)