#11383: Color('red') == Color('red') returns False
------------------------+---------------------------------------------------
Reporter: slabbe | Owner: slabbe
Type: defect | Status: needs_work
Priority: major | Milestone: sage-4.7.1
Component: graphics | Keywords: beginner, sd31
Work_issues: | Upstream: N/A
Reviewer: | Author: Ryan Grout
Merged: | Dependencies:
------------------------+---------------------------------------------------
Comment(by slabbe):
Another reason to be picky is the already present hashing behavior. Very
close colors get different hashing value, so we want those color not to be
equal. Otherwise we must change the hash method which is not a good idea I
think.
{{{
sage: hash(Color((1,0,0)))
188337232
sage: hash(Color((1.0,0,0)))
188338128
sage: hash(Color((1.0,0.0,0)))
188337616
sage: hash(Color((1.0,0.0,0.0)))
188337616
sage: hash(Color('red'))
188337360
sage: hash(Color((0.99999,0.0,0.0)))
188614128
}}}
From the [http://docs.python.org/reference/datamodel.html#object.__hash__|
Python Language Reference] : ''"The only required property is that objects
which compare equal have the same hash value"''.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11383#comment:7>
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.