TypeError: object cannot be interpreted as an index

Piet van Oostrum piet at cs.uu.nl
Wed Apr 8 12:44:54 CEST 2009


>>>>> "tleeuwenburg at gmail.com" <tleeuwenburg at gmail.com> (tc) wrote:

>tc> What, exactly, needs to be in place for an object to be a valid
>tc> dictionary key?

It must have __hash__ and __cmp__ or __eq__ methods. Newstyle classes
inherit these from object.
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org



More information about the Python-list mailing list