Python dict keys: Why custom objects work but lists don’t

Python dict keys: Why custom objects work but lists don't

Mutable builtins in Python cannot be dict keys. But your (mutable) classes can!

class C:
    def __init__(self, x):
        self.x = x
c = C(10)
d = {c:10}  # No error!
print(d[c]) # prints 10