#16537: Python 3 preparation: Use "rich comparison" - std function cmp() is
gone,
method __cmp__ is ignored
---------------------------------+------------------------
Reporter: wluebbe | Owner:
Type: PLEASE CHANGE | Status: new
Priority: major | Milestone: sage-6.4
Component: distribution | Resolution:
Keywords: python3 | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: #17175 | Stopgaps:
---------------------------------+------------------------
Comment (by nbruin):
Replying to [comment:5 rws]:
> Can the work be reduced by including the code in
http://www.voidspace.org.uk/python/articles/comparison.shtml into the
`SageObject` class?
I suspect that `sage.structure.element.Element` is a better location for
it, since `SageObject` doesn't have any comparison infrastructure, and
`Element` has.
In any case, the quoted code cannot be used verbatim, since these classes
are cdef cython, where the interface is via the `__richcmp__` special
method, not the various `__eq__` etc.
Element already has a `__richcmp__`, as well as a `__cmp__`. Precedence
rules for comparison lookup in Python 2 imply that `__cmp__` should never
be triggered. The implementation there in some branches will try to look
up `__cmp__`. This would be a good place to start looking into how much we
really depend on `__cmp__`.
--
Ticket URL: <http://trac.sagemath.org/ticket/16537#comment:6>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.