#11895: Make p-adic numbers unhashable
-------------------------------------+-------------------------------------
       Reporter:  mmasdeu            |        Owner:  roed
           Type:  defect             |       Status:  needs_work
       Priority:  critical           |    Milestone:  sage-6.4
      Component:  padics             |   Resolution:
       Keywords:  p-adic, hash       |    Merged in:
        Authors:                     |    Reviewers:
Report Upstream:  N/A                |  Work issues:  one pickle from the
         Branch:                     |  pickle jar does not unpickle
  u/saraedum/ticket/11895            |  correctly
   Dependencies:  #11670, #15897,    |       Commit:
  #15898, #15956, #16122, #16124,    |  42afa4d47da18d38095cd54313731f856ae5f083
  #16129, #16250, #16251, #16316,    |     Stopgaps:  todo
  #16317, #16318, #16321, #16339,    |
  #16341, #16342                     |
-------------------------------------+-------------------------------------

Comment (by saraedum):

 Replying to [comment:45 vbraun]:
 > But IMHO thats more of an issue with having two separate and competing
 ways of specifying precision, one in the parent and one in the element
 Is it really about competing ways? I guess this happens because it is
 possible to specify precision in the element at all.

 > Replying to [comment:44 saraedum]:
 > > I agree that disabling hashing has its drawbacks but I do not see an
 alternative.
 > I don't have a good answer right now either, but it once again shows the
 importance of this issue.
 > We need to fix our failure to adhere to Python's convention about
 comparison and hashes.
 The problem is that sometimes you want `a==b` to mean, `a` is essentially
 the same as `b`, say in an algorithm that doese `while(x!=0)`, and
 sometimes to you want it to mean `a` is indistinguishable from `b`. The
 latter is maybe what you want in dictionary lookups. But not always, for
 example if you have a dict which maps powers of `x`, the variable in a
 polynomial ring, to whatever, then you probably do not care about the
 precision of the `1` coefficient.
 So what I'm trying to say is that precision is tricky. Sure, many
 algorithms might just throw an exception if we disable hashing. But would
 they really work correctly otherwise? Whenever we make a dictionary lookup
 with elements with precision, it seems that we need to decide on a case by
 case basis which version of `==` would produce the right result. Throwing
 an exception and requiring people to explicitly specify what they want to
 happen seems to be a better solution IMO.

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