#16250: Monoids._test_one() incorrect for unhashable one elements
-------------------------------------+-------------------------------------
       Reporter:  saraedum           |        Owner:
           Type:  defect             |       Status:  needs_review
       Priority:  trivial            |    Milestone:  sage-6.3
      Component:  categories         |   Resolution:
       Keywords:  hash               |    Merged in:
        Authors:  Julian RĂ¼th        |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/saraedum/ticket/16250            |  7b35c8a32ea67041665dddd8f1d98c7b8cfb6141
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by saraedum):

 Replying to [comment:6 nthiery]:
 > I agree that it makes sense to disable the test if the object is not
 > hashable. On the other hand, I would much prefer to have an explicit
 > test like:
 > {{{
 >     isinstance(..., collections.Hashable)
 > }}}
 I thought about this too. I agree that this would be better in theory. The
 problem with this approach are things like matrices. They define a hash
 which raises a `TypeError` if the matrix is mutable.

 > Agreed, the right fix (tm) would probably be to remove the infamous
 > `SageObject.__hash__` method in the first place. Not all SageObjects
 > are hashable, and anyway computing the hash in term of `_repr_` is
 > just a continuous source of bugs. But this fix could take some work
 > since one would need to implement `__hash__` properly in a bunch of
 > places; so let's say that this is for a separate ticket.
 I agree. At first it seems that basing this on `_repr_` is exactly what
 one wants. But the little work you save is just not worth all the trouble
 it causes.

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