#17890: Remove _(rich)cmp_c_impl
-------------------------------------+-------------------------------------
Reporter: jdemeyer | Owner:
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-6.7
Component: cython | Resolution:
Keywords: | Merged in:
Authors: Jeroen Demeyer | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/jdemeyer/ticket/17890 | 04570b3dfd194fea8c2437c8717c3dfb8704b4af
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by jdemeyer):
Replying to [comment:60 vdelecroix]:
> Right, but `_richcmp` will call `_richcmp_`/`_cmp_`. In Integers (and
Rationals after #18304) there is also this `_cmp_` implemented and if
everything else failed in `__richcmp__` there is precisely
`Element._richcmp(self, other, op)`.
>
> So even if you implement a subset of `ZZ`/`QQ` as a new parent (let say
the additive group `3 ZZ` or the ring `ZZ[1/p]`) then it would be fine
with comparisons with integers/rationals as soon as you define a coercion
`3 ZZ -> ZZ`/`ZZ[1/p] -> QQ`. So my mistake, the situation for `ZZ` and
`QQ` is a bit different: `Integer/Rational` do not avoid coercion in rich
comparisons, they just try to avoid it for most common cases.
I guess you're right. It's just much less obvious (as `_cmp_` is used
after coercion, not `__richcmp__`).
> Do you have an example of a `Parent` where we want to avoid coercions?
See `src/sage/numerical/linear_functions.pyx` which deals with "symbolic"
linear inequalities. Here, `(a <= b) <= c` should construct the symbolic
inequality `a <= b <= c`.
--
Ticket URL: <http://trac.sagemath.org/ticket/17890#comment:61>
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.