◐ Shell
clean mode source ↗

Message 77199 - Python tracker

tp_richcompare is less convenient to implement than tp_compare. See for 
example how in Objects/longobject.c, long_richcompare() calls long_compare() *and* a helper method Py_CmpToRich.

Likewise, turning __cmp__ into the whole set of __lt__, __le__, __ge__, 
__gt__, __eq__, __ne__ methods (did I forget one?) is tedious.

I'm not talking for my own code, but for the python standard objects and 
library (and the Demo directory) where I'm currently trying to remove 
__cmp__ and tp_compare.

I am not far to write a hack (mixin, metaclass) to inject rich 
comparison functions based on a single __cmp__ function.