objects as mutable dictionary keys

Peter Maas peter at somewhere.com
Tue Dec 28 04:42:11 EST 2004


John Roth schrieb:
> No. The basic answer is that it's up to the object whether
> it will allow itself to be used as a dictionary key. In other
> words, if the designer of an object thinks it makes sense
> for instances to be dictionary keys, then he can supply a
> __hash__() method. If he doesn't, then he doesn't supply
> such a method, and it won't work.

Except for classic objects which can be used as dictionary
keys without having __hash__().

-- 
-------------------------------------------------------------------
Peter Maas,  M+R Infosysteme,  D-52070 Aachen,  Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
-------------------------------------------------------------------



More information about the Python-list mailing list