#18383: Coercion and comparison for alternating sign matrices
-------------------------------------+-------------------------------------
       Reporter:  vdelecroix         |        Owner:
           Type:  enhancement        |       Status:  needs_work
       Priority:  major              |    Milestone:  sage-6.7
      Component:  combinatorics      |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Vincent Delecroix  |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/vdelecroix/18383                 |  390e2d7cf57899cde4c7b096ef5b97f0be909574
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by vdelecroix):

 Replying to [comment:13 tscrim]:
 > We have to care about Python3 because it is the way going forward. The
 subtlety has come from us implementing a `__cmp__` at the general
 `Element` level, which gets called by the `cmp` first, and then instead of
 the default Python implementation of checking `__eq__` and `__lt__`, it
 tries to call `_cmp_` and then `_richcmp_`. This is a subtly caused by the
 current machinery in Sage. We need a mechanism which falls back to the
 usual Python rich comparisons for compatibility (although perhaps we need
 to make a single underscored version to work with coercion, but that is a
 question for sage-devel and I think there's already discussions about
 this).

 This is not that simple because at the level of the C API `__eq__`,
 `__lt__` etc does not exist. So there will be a huge difference between
 extension classes (ie Cython) and Python classes (ie Python). The uniform
 way that is proposed is precisely to use `_cmp_` or `_richcmp_` and avoid
 `__eq__`, etc.

 The fact that there is a global `__cmp__` in `Element` might be a problem
 but this is rather disjoint from the present ticket: for ASM we want
 coercion to be involved.

 Vincent

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