Python doesn't actually forbid them, it just sometimes makes you sometimes write a bit of extra code to use them. however, i'm pretty sure you can already find a discussion of this in the google-groups archive for this mailing list.
On Sat Feb 21 2015 at 9:12:20 PM Dawid Crivelli <[email protected]> wrote: > Moreover, if you put a mutable object into a dict and then change one of >> its fields and its hash depended on that field value, then it will be >> "lost" in the sense that if you check for that *same object* being in >> the dict, it will appear not to be, since it no longer ends up in the same >> hash bucket. > > I had that bite me a few weeks ago, when all the keys in the dictionary > pointed to the same array, i.e. the last key inserted. Wouldn't it be > sensible to copy the mutable keys by default, or at least have some warning > in the documentation? I've recently learned that Python forbids mutable key > types for that exact same reason. >
