#19597: General code cleanup: avoid code like x.__eq__(y)
-------------------------------------+-------------------------------------
       Reporter:  jdemeyer           |        Owner:
           Type:  enhancement        |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.10
      Component:  misc               |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Jeroen Demeyer     |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/jdemeyer/general_code_cleanup__avoid_x___eq___y_|  
b2094a8a1cedafab73db0ed7653db3112982cec4
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by jdemeyer):

 Replying to [comment:10 jdemeyer]:
 > In `src/sage/combinat/crystals/tensor_product.py`, you are probably
 wondering why I still use `__lt__` instead of `<` for example. That's
 because the `__lt__` method can return `NotImplemented`. In this case, the
 output of `x < y` is not the same as `x.__lt__(y)`.

 Let me also mention that this is the only place in Sage where a comparison
 method `__lt__`, `__gt__`, `__le__` or `__ge__` returns `NotImplemented`.

 In `src/sage/combinat/words/abstract_word.py`, there is an `__eq__` which
 can return `NotImplemented`, but I don't think there is a problem there: I
 believe calling `self == other` in `__ne__` is still the right thing to
 do.

 And there are several other places where a `__richcmp__` can return
 `NotImplemented` but those are not affected by this ticket.

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