#17427: x==y while hash(x)!=hash(y) with SchemeMorphism_point_projective_field
---------------------------------+------------------------
       Reporter:  ncohen         |        Owner:
           Type:  defect         |       Status:  new
       Priority:  major          |    Milestone:  sage-6.5
      Component:  PLEASE CHANGE  |   Resolution:
       Keywords:                 |    Merged in:
        Authors:                 |    Reviewers:
Report Upstream:  N/A            |  Work issues:
         Branch:                 |       Commit:
   Dependencies:                 |     Stopgaps:
---------------------------------+------------------------

Comment (by nbruin):

 Replying to [comment:3 bhutz]:
 > Although, I'm not sure why this is bad.
 It's against contract. It will make behaviour unpredictable if you use
 these objects as keys in a dictionary. Python will initially select a
 place in the dictionary based on some bits in the hash value, but if that
 spot is taken, python will test if the keys agree by testing for equality.
 So whether
 {{{
 {P(1,1):1, P(n,n):2}
 }}}
 leads to a dictionary with one or two elements will depend on the value of
 n. It's really hard to force hash collisions in python so the behaviour is
 very rare, which makes it even more dangerous.

 Without`a==b` implies `hash(a)==hash(b)` a hash is useless (it's the only
 property a hash MUST have)

--
Ticket URL: <http://trac.sagemath.org/ticket/17427#comment:4>
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.

Reply via email to