Re: Freezing a mutable (was Re: lambda)

2005-01-21 Thread Antoon Pardon
Op 2005-01-21, Bengt Richter schreef <[EMAIL PROTECTED]>: > On 20 Jan 2005 14:07:57 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote: > > Would you like a dictionary that acts as you want and takes care of all > problems internally, and accepts keys and values of any type without wrapping > or other mo

Re: Freezing a mutable (was Re: lambda)

2005-01-20 Thread Bengt Richter
On 20 Jan 2005 14:07:57 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote: >Op 2005-01-20, Nick Coghlan schreef <[EMAIL PROTECTED]>: >> Antoon Pardon wrote: >>> I missed that you would use it with the idiom: dct[x.frozen()] >> >> The list itself isn't hashable with this approach, so you don't have much

Re: Freezing a mutable (was Re: lambda)

2005-01-20 Thread Antoon Pardon
Op 2005-01-20, Nick Coghlan schreef <[EMAIL PROTECTED]>: > Antoon Pardon wrote: >> I missed that you would use it with the idiom: dct[x.frozen()] > > The list itself isn't hashable with this approach, so you don't have much > choice. I wasn't particularly clear about that point, though. > >> I hav

Re: Freezing a mutable (was Re: lambda)

2005-01-20 Thread Nick Coghlan
Antoon Pardon wrote: I missed that you would use it with the idiom: dct[x.frozen()] The list itself isn't hashable with this approach, so you don't have much choice. I wasn't particularly clear about that point, though. I have two problems with this approach. 1) It doesn't work when you get your

Re: Freezing a mutable (was Re: lambda)

2005-01-20 Thread Antoon Pardon
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

Freezing a mutable (was Re: lambda)

2005-01-20 Thread Nick Coghlan
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