TypeError: object cannot be interpreted as an index

TennesseeLeeuwenburg tleeuwenburg at gmail.com
Thu Apr 9 00:54:49 CEST 2009


On Apr 8, 8:44 pm, Piet van Oostrum <p... at cs.uu.nl> wrote:
> >>>>> "tleeuwenb... at gmail.com" <tleeuwenb... 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 <p... at cs.uu.nl>
> URL:http://pietvanoostrum.com[PGP 8DAE142BE17999C4]
> Private email: p... at vanoostrum.org

Awesome, thanks.

I wonder if this is an 'old-style' class, something I've never used
myself... I'll have to do some research.

-T



More information about the Python-list mailing list