I have already asked about some strange behavior of rich camparison in
"rich comparision for elements". In the meantime I've written a little
patch. Michael asked me to first discuss it here, so here it is:
http://www.matha.rwth-aachen.de/~martin/element.pyx.patch .
Motivation: The old behavior was intransparent from a mathematical
point of view, since if no coercion applied, __cmp__ was called and no
rich comparison was applied.
Solution: _richcmp is now aware of the presence of __cmp__ and _cmp_
and uses them if _richcmp_ or _richcmp_c_impl, respectively, are not
implemented.
Additional changes: _cmp_ is now the preferred function to be called.
This is more efficient than checking coercions once again. Moreover it
seems to be a more consequent notation. The most important point is,
that I don't think we should encourage overwriting __cmp__ in the
super classes, which is a python function and always should apply
appropriate coercion - except those special cases occurring for
example in ring/infinity.py .

I'd like to ask for comments, in particular, on the last point.

Martin
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to