#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:17 tscrim]:
> Replying to [comment:16 vdelecroix]:
> > Replying to [comment:15 tscrim]:
> > > The uniform way would be to have the generic `_richcmp_` default
back to using the python `__eq__`, etc. It may not be simple to implement,
but it is the IMO correct way to do things as we should not be making
ourselves less Python3 compliant. Plus I thought by having `_richcmp_`
being a Python method, we could then call the `__lt__`, or at least use
`getattr`. Moreover, this is only a problem for doing comparisons with
`cmp`, which will be moot once we do switch.
> >
> > We can not do that. The method `__richcmp__` (and hence `_richcmp_`)
is not used at all if `__eq__`, `__lt__`, etc are implemented in a Python
class.
>
> For rich comparisons, yes. However for `cmp`, the code path currently
completely bypasses the rich comparisons because it calls `__cmp__` (which
calls `_cmp` which calls `_cmp_` and errors out).
This has been fixed in #18322.
> > > > 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.
> > >
> > > It's quite relevant because it is part of your proposal. In the
current version of Sage, if the other element is not an ASM, then it lifts
itself to the matrix space and does the comparison there (in that it
compares against its defining matrix).
> >
> > Do you have an example involving rich comparisons that differ?
> I'm not sure what you're asking for.
I wanted an example of a comparison that is different before and after my
branch.
--
Ticket URL: <http://trac.sagemath.org/ticket/18383#comment:18>
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.