Op 2004-12-15, Roel Schroeven schreef <[EMAIL PROTECTED]>:
> 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.

And I think that is a stupid reason. There are enough other situations
were people work with mutable objects but don't wish to mutate specific
objects.  Like objects in a sorted sequence you want to keep that way
or objects in a heapqueue etc.

Demanding that users of dictioanaries somehow turn their mutable objects
into tuples when used as a key and back again when you retrieve the keys
and need the object can IMO ibe a bigger support nightmare than the
possibility that code mutates a key in a dictionary.

-- 
Antoon Pardon
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to