On Wed, Mar 30, 2016, at 01:43, Steven D'Aprano wrote: > This is not an argument about dicts being mutable, because clearly they > aren't. This is an argument about key:value pairs being stable. "Stable" > doesn't mean "immutable". If you change the value associated with a key > directly, then it will change. That's the whole point. But if you change > *one* key, the relationship between *other* keys and their values > shouldn't > change.
This doesn't mean that an object violates the contract by having a method that changes the relationships between multiple keys and values. I had considered including an example of replacing the _whole dictionary_ with a new object in the ellipsis. Absolutely nothing is stable under a *completely unrestricted* set of operations. > Specifically, insertions and deletions to the mapping never affect the > existing keys. You can't say that, because there is no insert and delete method in the mapping interface. > If somebody wants to insist that this is a kind of mapping, I can't > disagree, but it isn't useful as a mapping type. Javascript seems to manage it just fine. -- https://mail.python.org/mailman/listinfo/python-list