Consider this code:
a = {...} # a is an dict with arbitrary contents
b = a.copy()
There's really no guarantee that a type which is hashable is also immutable, but at very least, correctly implementing __hash__
requires that the type is immutable, with respect to its own hash, and to equality. This is not enforced in any particular way.
However, we are all adults. It would be unwise to implement __hash__
unless you really meant it. Roughly speaking, this just boils down to saying that if a type actually can be used as a dictionary key, then it is intended to be used in that way.
If you're looking for something that is like a dict, but also immutable, then namedtuple might be your best bet from what's in the standard library. Admittedly it's not a very good approximation, but it's a start.