richcmpfunc semantics

harold fellermann harold.fellermann at upf.edu
Wed Apr 6 14:11:08 EDT 2005


Hi all,

I want to implement rich comparision in an extension class. Problem is 
I cannot
find good documentation of the richcmpfunc semantics. Given the 
signature

richcmpfunc compare(PyObject *,PyObject, int);

I supposed the two objects passed are the ones to be compared.
What is the meaning of the integer argument? Does it specify the kind
of comparision operator (e.g. __eq__ or __le__), and if so, how?
What is my richcmpfunc supposed to return? 0 or 1 indicating False or
True? What has to be done, if the function is invoked for an operator
I don't want to define?

Maybe there is some good documentation available, but I cannot find it.
So, any references or help is appreciated.

Cheers,

- harold -

--
"Scientist are very good in answering the questions
they choose to answer."
-- Richard Alley




More information about the Python-list mailing list