Mutable
adjective
say it: “MYOO-tuh-bul” /ˈmjutəbəl/
Able to be changed after it is made; in Python, lists, dictionaries and sets are mutable, while strings, numbers and tuples are not.
What does mutable mean?
A mutable value can be changed after it's created. Lists, dictionaries and sets are mutable.
cart = ["shirt"]
cart.append("hat") # the same list, now changed
print(cart) # ['shirt', 'hat']
In a sentence
- “A list is mutable, so append() changes the same cart instead of making a new one.”
- “Because dictionaries are mutable, the update in one function showed up everywhere that used it.”
Level: Apprentice · More Python terms at this level
Updated