Article directory
In Python, all data types can be divided into two categories: mutable objects (Mutable) and immutable objects (Immutable). This is an important concept in Python, which affects the behavior of variable assignment, function parameter passing, and data modification.
1. Mutable objects
A mutable object means that its internal data can be modified after creation without changing its identity (id). That is to say, the content of the mutable object can be modified, but its reference address will not change.
Common mutable objects are:
- list
- dictionary (dict)
- set
Example:
# 列表是可变对象
my_list = [