#13814: LazyFamily.__eq__ gives false positives.
------------------------------------+---------------------------------------
       Reporter:  cnassau           |         Owner:  sage-combinat
           Type:  defect            |        Status:  needs_review 
       Priority:  major             |     Milestone:  sage-5.6     
      Component:  combinatorics     |    Resolution:               
       Keywords:                    |   Work issues:               
Report Upstream:  N/A               |     Reviewers:               
        Authors:  Christian Nassau  |     Merged in:               
   Dependencies:                    |      Stopgaps:               
------------------------------------+---------------------------------------

Comment (by nthiery):

 Replying to [comment:16 cnassau]:
 > I have implemented a new patch, based on Sage 5.5.rc0. Here are the key
 features:
 >
 > The new {{{LazyFamily.__eq__}}}
 >
 >   *  does not compare function values (even if the indexing set is
 finite)
 >   *  recognizes identical function objects
 >   *  uses {{{self.function.__eq__}}} if this is available
 >   *  otherwise treats functions as distinct
 >
 > Furthermore
 >
 >   *  "{{{f != g}}}" is exactly equivalent to "{{{not(f==g)}}}"

 Great, thanks!

 > Contrary to my expectations there were not that many doctest failures.
 The only affectes files were ``family.py`` and
 ``disjoint_union_enumerated_sets.py``.

 That's definitely good news.

 Should I remove the previous patch? Then we won't have to specify
 which patch to apply.

 A couple questions:

 Would there be a problem to just compare the functions with:
 {{{
    self.function == other.function
 }}}
 Rather than doing the check for is and then for eq?

 I am surprised about your comment about Permutations not being
 picklable. This works for me:
 {{{
   sage: P = Permutations(3)
   sage: P == Permutations(3)
   True
   sage: P == loads(dumps(P))
   True
 }}}

 Could the hash be calculated using both the hash of the indexing set
 and the function?

 Please take the occasion to rewrite {{{WARNING}}} into
 {{{.. WARNING::}}} (see the developers manual for the exact syntax).

 Where is ``!=`` implemented?


 Cheers,
                           Nicolas

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