#9016: make morphisms hashable
-----------------------------+----------------------------------------------
   Reporter:  burcin         |       Owner:  AlexGhitza  
       Type:  defect         |      Status:  needs_review
   Priority:  major          |   Milestone:  sage-4.4.3  
  Component:  algebra        |    Keywords:              
     Author:  Burcin Erocal  |    Upstream:  N/A         
   Reviewer:                 |      Merged:              
Work_issues:                 |  
-----------------------------+----------------------------------------------
Changes (by burcin):

 * cc: robertwb (added)
  * status:  new => needs_review


Comment:

 There seems to be a problem with inheriting `__hash__()` methods. The
 class `sage.categories.morphism.SetMorphism` derives from
 `sage.categories.morphism.Morphism` which in turn derives from
 `sage.categories.map.Map`.

 Even after adding a `__hash__()` method to `sage.categories.map.Map`,
 instances of `SetMorphism` are not hashable:

 {{{
 sage: from sage.categories.morphism import SetMorphism
 sage: X.<x> = ZZ[]
 sage: Y = ZZ
 sage: phi = SetMorphism(Hom(X, Y, Rings()), lambda p: p[0])
 sage: hash(phi)
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)

 /home/burcin/sage/sage-4.4.1.alpha2-patched/<ipython console> in
 <module>()

 TypeError: unhashable type: 'sage.categories.morphism.SetMorphism'
 }}}

 Note also that `sage.categories.map.Map` derives from
 `sage.structure.element.Element` which also has a `__hash__()` method.

 Any hints?

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

Reply via email to