#9016: make morphisms hashable
---------------------------------+------------------------------------------
       Reporter:  burcin         |         Owner:  AlexGhitza                   
    
           Type:  defect         |        Status:  needs_review                 
    
       Priority:  major          |     Milestone:  sage-5.6                     
    
      Component:  categories     |    Resolution:                               
    
       Keywords:                 |   Work issues:                               
    
Report Upstream:  N/A            |     Reviewers:  Robert Bradshaw, Travis 
Scrimshaw
        Authors:  Burcin Erocal  |     Merged in:                               
    
   Dependencies:                 |      Stopgaps:                               
    
---------------------------------+------------------------------------------

Old description:

> Attached patch makes morphisms hashable in a reasonably fast way by
> defining the following:
>
> {{{
>     def __hash__(self):
>         return hash((self._domain, self._codomain))
> }}}
>
> It also defines specialized methods for
> `sage.rings.morphism.RingHomomorphism_im_gens` and
> `sage.rings.morphism.RingHomomorphism_from_quotient`.
>
> While testing the code for `im_gens`, I fixed a confusing error message
> in `sage.structure.sequence.Sequence.__hash__()` as well.
>
> Apply: [attachment:trac_9016-morphism_hash.patch]

New description:

 Attached patch makes morphisms hashable in a reasonably fast way by
 defining the following:

 {{{
     def __hash__(self):
         return hash((self._domain, self._codomain))
 }}}

 It also defines specialized methods for
 `sage.rings.morphism.RingHomomorphism_im_gens` and
 `sage.rings.morphism.RingHomomorphism_from_quotient`.

 While testing the code for `im_gens`, I fixed a confusing error message in
 `sage.structure.sequence.Sequence.__hash__()` as well.

 Apply: [attachment:trac_9016-morphism_hash.take7.patch]

--

Comment (by burcin):

 I attached a new patch replacing the doctests with `hash(f) == hash(f)`
 and `{f: 1}[f]` as Robert suggests.

 Apply [attachment:trac_9016-morphism_hash.take7.patch].

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