tp_compare help?

Pete Shinners pshinners at mediaone.net
Sun Sep 17 14:40:05 EDT 2000


the documentation is sort of missing for the definition of
the tp_compare routine for my extension object.

i can't quite seem to figure out exactly what i should
be doing. it looks like python only calls my compare
routine if the compared objects are the same types?
my object fully implements the sequence interface, and
i'd like to compare my object with other sequences
without casting them to the same types.
(well, not really casting, but creating a temporary object
of the same type)

is this the case? can i change this behaviour? what should
i return in the case of an error? it looks like some of the
included modules just return -1, but should i be calling
PyErr_SetString maybe?


(whew, i finally fixed all the refcounting problems of
mine (i hope). most had to do with the 'laziness' of
the SetItem and GetItem routines. not a bad thing, but
before i figured it out, quite a puzzler) :]





More information about the Python-list mailing list