Mutability in Python

Learn about different mutable and immutable data types.

We'll cover the following

We say an object is mutable if its value can be changed after it has been created. An object is immutable if its value is fixed when it is created and can never be changed. Immutable values are, in effect, read-only values. In this chapter, we will look at mutability in Python and the pros and cons of both types of objects.


In Python, it is usually an object’s type that tells you whether it is mutable or not. For example, lists are mutable. If you create a list, you can change it in various ways, as shown here:

Get hands-on with 1200+ tech skills courses.