#11383: Color('red') == Color('red') returns False
----------------------------------+-----------------------------------------
Reporter: slabbe | Owner: slabbe
Type: defect | Status: needs_work
Priority: major | Milestone: sage-5.0
Component: graphics | Resolution:
Keywords: beginner, sd31 | Work issues:
Report Upstream: N/A | Reviewers:
Authors: Ryan Grout | Merged in:
Dependencies: | Stopgaps:
----------------------------------+-----------------------------------------
Comment (by poeschko):
As suggested, I added a new `__hash__` method (including doctests) that
uses `__rgb` just like `__eq__` and did some minor code improvements in
the original patch. Note that this is a rather "picky" approach, e.g.
{{{
sage: Color((0.99999,0.0,0.0)) == Color((1,0,0))
False
}}}
All tests pass (in Sage 5.0.beta11 under Mac OS X 10.5.8/Intel), so I
think this works fine.
By the way (@kini), the issue with green is that
{{{
sage: Color('green').rgb()
(0.0, 0.5019607843137255, 0.0)
}}}
so this is bound not be equal to `Color((0,1,0))`. `Color('lime')` is RGB
green.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11383#comment:13>
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.