On Wed, 15 Dec 2004 14:18:21 GMT, Roel Schroeven <[EMAIL PROTECTED]> wrote: >Antoon Pardon wrote: > > Op 2004-12-15, Fredrik Lundh schreef <[EMAIL PROTECTED]>: > >>sorry, but I don't understand your reply at all. are you saying that > >>dictionaries > >>could support mutable keys (e.g lists) by making a copy of the key? how > >>would > >>such a dictionary pick up changes to the original key object? (I'm talking > >>about > >>the key stored in the dictionary, not the key you're using to look things > >>up). > > > > > > You want to mutate a key that is within a dictionary? > > No, we don't want to mutate it; as far as I know, that is exactly the > reason why dictionaries don't support mutable keys.
Dictionaries support mutable keys just find. What they don't support is unhashable keys. For some objects, this is an important distinction: lists are mutable but not hashable. For other objects, it is not: instances of user defined classes are mutable and hashable. This is handy since the default hash is based on identity instead of the values of attributes. Mutating an object in a dictionary is completely reasonable. What is unreasonable is wanting to make a change that would change its hash value. Jp -- http://mail.python.org/mailman/listinfo/python-list