Differences Between Python's Mutable and Immutable Types

As a Python developer, you’ll have to deal with mutable and immutable objects sooner or later. Mutable objects are those that allow you to change their value or data in place without affecting the object’s identity. In contrast, immutable objects don’t allow this kind of operation. You’ll just have the option of creating new objects of the same type with different values.

In Python, mutability is a characteristic that may profoundly influence your decision when choosing which data type to use in solving a given programming problem. Therefore, you need to know how mutable and immutable objects work in Python.

In this video course, you’ll:

  • Understand how mutability and immutability work under the hood in Python
  • Explore immutable and mutable built-in data types in Python
  • Identify and avoid some common mutability-related gotchas
  • Understand and control how mutability affects your custom classes

What’s Included:

Downloadable Resources:

About Stephen Gruppetta

Stephen worked as a research physicist in the past, developing imaging systems to detect eye disease. He now focuses on Python education!

» More about Stephen

Each tutorial at Real Python is created by a team of developers so that it meets our high quality standards. The team members who worked on this tutorial are:

← Browse All Courses