Message77199
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. |
|
Date |
User |
Action |
Args |
2008-12-07 00:23:12 | amaury.forgeotdarc | set | recipients:
+ amaury.forgeotdarc, gvanrossum, brett.cannon, georg.brandl, rhettinger, mark.dickinson, christian.heimes, benjamin.peterson |
2008-12-07 00:23:12 | amaury.forgeotdarc | set | messageid: <1228609392.36.0.353480655221.issue1717@psf.upfronthosting.co.za> |
2008-12-07 00:23:11 | amaury.forgeotdarc | link | issue1717 messages |
2008-12-07 00:23:10 | amaury.forgeotdarc | create | |
|