#18251: Equality comparison with 0 is not consistant
------------------------+----------------------------
Reporter: tscrim | Owner: tscrim
Type: defect | Status: new
Priority: critical | Milestone: sage-6.7
Component: coercion | Keywords: zero
Merged in: | Authors:
Reviewers: | Report Upstream: N/A
Work issues: | Branch:
Commit: | Dependencies:
Stopgaps: |
------------------------+----------------------------
Currently we have the following in Sage:
{{{
sage: C = CombinatorialFreeModule(QQ, ['a','b'])
sage: C.zero() == ZZ(0)
True
sage: C.zero() == QQ(0)
False
sage: M.zero()
(0, 0, 0, 0)
sage: M.zero() == ZZ(0)
True
sage: M.zero() == QQ(0)
False
}}}
What I've been doing has been implementing a custom `__eq__` which checks
explicitly for the other argument is 0 and then checking `self.is_zero`.
However I'm thinking we should have a general fix with this as a special
case, but we could do it just for these element classes.
Additionally this works when there a coercion from the base ring. I guess
more generally do we want equality checking for when there is a conversion
to the base ring? Thoughts?
--
Ticket URL: <http://trac.sagemath.org/ticket/18251>
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.