Op 2005-01-20, Nick Coghlan schreef <[EMAIL PROTECTED]>: > Antoon Pardon wrote: >> Interesting idea. But I think you are wrong when you say that two lists >> that compare equal at the time they are frozen, will get the same >> dictionary entry. The problem is an object must compare equal to >> the key in the dictionary to get at the same entry. So if you freeze >> a list and its copy but then mutate them differently, they no longer >> are equal and so wont get you at the same entry. > > The trick is that the result of the freezing operation is cached until such > time > as you explicitly unfreeze the object.
I missed that you would use it with the idiom: dct[x.frozen()] I have two problems with this approach. 1) It doesn't work when you get your keys via the keys/items methods. 2) This is rather minor, but a user could still unfreeze untimely -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list