[issue1717] Get rid of more refercenes to __cmp__

Amaury Forgeot d'Arc report at bugs.python.org
Sun Dec 7 01:23:12 CET 2008


Amaury Forgeot d'Arc <amauryfa at gmail.com> added the comment:

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.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1717>
_______________________________________


More information about the Python-bugs-list mailing list