# In Python, a name is a sticker, not a box

> Two names can sit on one object. Whether it can change is what makes lists and strings behave differently.

- **Format:** short video, 8 steps, ~24 seconds
- **Topic:** How mutable and immutable variables work in Python
- **Author:** Suthahar Jegatheesan (MSDEVBUILD)
- **Category:** Programming · Python
- **Tags:** python, pythonprogramming, learnpython, coding, programming, softwareengineering, developer, codenewbie, pythontips, devcommunity, msdevbuild
- **Canonical URL:** https://blog.msdevbuild.com/shorts/python-mutable-vs-immutable/

---
## What you'll learn

- Why b = a is a second name, not a copy
- Which Python types change in place and which are replaced
- How the mutable default argument bug gets written

## Understand it one step at a time

### 1. You changed b, a changed too

A list assigned to a second name is not a copy. Both names sit on one object.

### 2. b = a copies the sticker

The list is built once in memory. The second line just points another name at it.

### 3. A list is mutable

append edits the object itself. The id never changes, so both names show the new value.

### 4. A string is immutable

It cannot be edited, so += builds a new object and moves only that one name.

### 5. Which types are which

Numbers, strings and tuples cannot change. Lists, dicts and sets can.

### 6. This is the classic bug

A mutable default argument is created once, then quietly reused by every call.

### 7. The fix is a fresh object

Default to None and build the list inside, or copy before you mutate.

### 8. Mutate or rebind

Every confusing line in Python comes down to which of these two it is doing.

---

## The takeaway

**Names point. Objects change, or they do not.**

Mutable objects change in place and every name sees it. Immutable objects are replaced, and only one name moves.
