#11383: Color('red') == Color('red') returns False
------------------------+---------------------------------------------------
Reporter: slabbe | Owner: slabbe
Type: defect | Status: needs_work
Priority: major | Milestone: sage-4.8
Component: graphics | Keywords: beginner, sd31
Work_issues: | Upstream: N/A
Reviewer: | Author: Ryan Grout
Merged: | Dependencies:
------------------------+---------------------------------------------------
Comment(by ryan):
I think that redefining __hash__ would work. Is there an example where
the already published patch fails. I don't understand how comparing the
hashes is better than directly comparing
{{{xx._Color__rgb==tt._Color__rgb}}}
{{{
sage: a,b
(0.8216543768062763, 0.3482611655758555)
sage: print a,b
0.821654376806 0.348261165576
sage: b = a-.000000000000000000001
sage: b
0.821654376806276
sage: a
0.8216543768062763
sage: a==b
True
sage: xx = Color((a,b,0))
sage: tt = Color((b,a,0))
sage: xx==tt
True
sage: hash(xx)==hash(tt)
False
sage: hash(xx._Color__rgb)==hash(tt._Color__rgb)
True
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11383#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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.