Op 2004-12-15, Steve Holden schreef <[EMAIL PROTECTED]>:
> Antoon Pardon wrote:
>
>> 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.
>> 
> So provide your objects with a __hash__ method, and you can use them as 
> dictionary keys.
>
> Sheesh, learn Python already. What a troll. [Plonk]
>

Let me get this straight.

You first say dictionaries don't support mutable keys for some reason.

I say I find it a stupid reason.

Then you mark me a troll because I don't know the language while at
the same time making a suggestion that implies your original remark
about python was wrong.

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

Reply via email to