In article ,
moerchendiser2k3 wrote:
>
>Do I need to implement both? Looks very redundant, isnt it? Or is it
>just an extension and tp_richcompare is the better choice here? Can
>anyone please make the light on here? :)
Nobody else responded, so please take this non-expert advice:
Hi all,
just another question. Can anyone explain me whats the real difference
between tp_richcompare and tp_compare? I read some stuff, but
sometimes I believe the author doesnt know either whats the real
difference or they forget it to explain. The Function definition looks
very similiar
Sreeram Kandallu wrote:
> I'm writing an extension type, for which i'd like to implement only ==
> and !=, but not the other comparison operators like <,<=,>,>=.
> What is the right way to do this?
> I currently have a tp_richcompare function, which handle
I'm writing an extension type, for which i'd like to implement only ==
and !=, but not the other comparison operators like <,<=,>,>=.
What is the right way to do this?
I currently have a tp_richcompare function, which handles Py_EQ, and
Py_NE, but raises a TypeError for th
ype->tp_flags & base->tp_flags & Py_TPFLAGS_HAVE_RICHCOMPARE) {
if (type->tp_compare == NULL &&
type->tp_richcompare == NULL &&
type->tp_hash == NULL)
{
type-&