[Cython] self not typed in __richcmp__

Stefan Behnel stefan_ml at behnel.de
Sun Jan 18 08:50:37 CET 2009


Hi,

Hoyt Koepke wrote:
> Something seems really wrong here, maybe with my code.  It seems that
> the self argument of __richcmp__ is not typed correctly.  Before I
> file a bug report, is __richcmp__ treated as a static method with the
> arguments still being each of the tested objects?

Sort of. It's mapped to PyObject_RichCompare(), which takes two arbitrary
objects and compares them.

http://docs.python.org/c-api/object.html

The C-API does this as the first object may not support the required
operation, in which case the operands will end up being reversed and passed
to the second object.

I just noticed that this isn't in the FAQ in our Wiki. It's definitely
worth going there.

Stefan



More information about the Cython-dev mailing list