Chris Angelico <>:

> On Wed, Aug 9, 2017 at 7:51 PM, Marko Rauhamaa <> wrote:
>> Mutable objects can be used as keys into a dictionary.
> Only when the objects' mutability does not affect their values.

Up to equality. The objects can carry all kinds of mutable payload as
long as __hash__() and __eq__() don't change with it.

And Python doesn't enforce this in any way except for lists. That's
somewhat unfortunate since sometimes you really would like an immutable
(or rather, no-longer-mutable) list to act as a key.


Reply via email to