hash values and equality
Irmen de Jong
irmen.NOSPAM at xs4all.nl
Sat May 21 19:07:28 EDT 2011
On 22-5-2011 0:55, John Nagle wrote:
> On 5/19/2011 11:33 PM, Ulrich Eckhardt wrote:
>
>> For that reason, it is generally useful to use immutable types like
>> integers, floats, strings and tuples thereof as keys. Since you can't change
>> them, you basically have the guarantee that they hash the same.
>
> Right. It's something of a lack that Python doesn't
> have user-defined immutable objects.
>
> John Nagle
>
collections.namedtuple is rather powerful though... and can be used as key AFAIK.
Irmen
More information about the Python-list
mailing list