#18305: Element comparison for Python classes
-------------------------------------+-------------------------------------
       Reporter:  vdelecroix         |        Owner:
           Type:  enhancement        |       Status:  needs_work
       Priority:  major              |    Milestone:  sage-6.9
      Component:  coercion           |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Vincent Delecroix  |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/vdelecroix/18305                 |  3f6ea84eb645f1e29426bedc7763c9f31997867b
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------
Changes (by jdemeyer):

 * status:  needs_review => needs_work


Comment:

 This is not good, you're adding back stuff which was removed:
 {{{
 #!diff
 diff --git a/src/sage/structure/element.pyx
 b/src/sage/structure/element.pyx
 index ede0157..4208a50 100644
 --- a/src/sage/structure/element.pyx
 +++ b/src/sage/structure/element.pyx
 @@ -1043,10 +1043,16 @@ cdef class Element(SageObject):
              return rich_to_bool(op, -1)

      ####################################################################
 -    # For a Cython class, you must define either _cmp_ (if your subclass
 -    # is totally ordered), _richcmp_ (if your subclass is partially
 -    # ordered), or both (if your class has both a total order and a
 -    # partial order, or if implementing both gives better performance).
 +    # For a derived Cython class, you **must** put the __richcmp__
 +    # method below in your subclasses, in order for it to take
 +    # advantage of the above generic comparison code. If you want to use
 cmp()
 +    # but did not implement a rich comparison, then you must copy paste
 the
 +    # __cmp__ method below.
 +    #
 +    # In a Cython or a Python class, you must define either _cmp_
 +    # (if your subclass is totally ordered), _richcmp_ (if your subclass
 +    # is partially ordered), or both (if your class has both a total
 order
 +    # and a partial order, or if that gives better performance).
      #
      # Rich comparisons (like a < b) will default to using _richcmp_,
      # three-way comparisons (like cmp(a,b)) will default to using
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/18305#comment:31>
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.

Reply via email to