#17890: Remove _(rich)cmp_c_impl
-------------------------------------+-------------------------------------
Reporter: jdemeyer | Owner:
Type: enhancement | Status: needs_info
Priority: major | Milestone: sage-6.6
Component: cython | Resolution:
Keywords: | Merged in:
Authors: Jeroen Demeyer | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/jdemeyer/ticket/17890 | a7cbb88852ceefff65e421e75c0479bcd554ce26
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Changes (by vdelecroix):
* status: needs_review => needs_info
Comment:
== sage.structure.element ==
1. In the documentation of `sage.structure.element` emphasize what should
be done for Python classes as well (and the potential difference between
Python and Cython). It is not very clear to me! What I understood is that
we should:
- implement `__cmp__(left,right)` or/and `_richcmp_(left,right,op)`
- avoid `__eq__`, `__ne__`, etc
2. What about putting
{{{
# Obvious case
if left is right:
return _rich_to_bool(op, 0)
}}}
directly in `__richcmp__`?
== sage.structure.parent ==
3. The default comparison for parents is by id which is natural (and I
guess what Python does). But the default hash is not based on id and is
the stupid one inherited from `SageObject`. Is there a reason?
4. Why not using `_rich_to_bool` in `parent.pyx` instead of
{{{
if op == 0: #<
return r < 0
elif op == 2: #==
return r == 0
elif op == 4: #>
return r > 0
elif op == 1: #<=
return r <= 0
elif op == 3: #!=
return r != 0
elif op == 5: #>=
return r >= 0
}}}
And by the way, why is there a method `cdef _rich_to_bool` on element?
it would be useful as a standalone function in other places.
--
Ticket URL: <http://trac.sagemath.org/ticket/17890#comment:20>
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.