Posts tagged mutability

Hashability vs Mutability

What is the actual difference between something that is hashable and something that is mutable? Why does this distinction even exist in Python?

One of our favorite questions here at Don’t Use This Code is: “What is the difference between a list and a tuple?” This often leads to some discussion of hashability and mutability, but even more interestingly, we talk about the use cases of a list vs a tuple. When do they come up in code? Why are they used for different purposes? Why not always use a list?

Read more ...