#13589: Controlling C3 to solve once for all the Method Resolution Order issues 
for
category classes
----------------------------------------------------------+-----------------
       Reporter:  nthiery                                 |         Owner:  
nthiery                   
           Type:  defect                                  |        Status:  
needs_review              
       Priority:  major                                   |     Milestone:  
sage-5.10                 
      Component:  categories                              |    Resolution:      
                      
       Keywords:  method resolution order, C3             |   Work issues:      
                      
Report Upstream:  N/A                                     |     Reviewers:  
Simon King, Florent Hivert
        Authors:  Nicolas M. ThiƩry                       |     Merged in:      
                      
   Dependencies:  #13501, #12894, #12876, #11935, #12895  |      Stopgaps:      
                      
----------------------------------------------------------+-----------------

Comment (by SimonKing):

 For the record, the only failing example is this:
 {{{
 File "devel/sage/sage/misc/c3_controlled.pyx", line 266, in
 sage.misc.c3_controlled
 Failed example:
     for l in L:                                          # long time
         x = HierarchyElement(10, l.to_poset())
         assert x.mro            == list(P)
         assert x.mro_controlled == list(P)
         assert x.all_bases_len() == 15
         assert x.all_bases_controlled_len() == 19
         try:
             x.mro_standard
             assert False
         except:
             pass
 Exception raised:
     Traceback (most recent call last):
       File "/home/simon/SAGE/prerelease/sage-5.9.rc0/local/lib/python2.7
 /site-packages/sage/doctest/forker.py", line 466, in _run
         self.execute(example, compiled, test.globs)
       File "/home/simon/SAGE/prerelease/sage-5.9.rc0/local/lib/python2.7
 /site-packages/sage/doctest/forker.py", line 825, in execute
         exec compiled in globs
       File "<doctest sage.misc.c3_controlled[35]>", line 6, in <module>
         assert x.all_bases_controlled_len() == Integer(19)
     AssertionError
 }}}

 Indeed, on the command line, I get
 {{{
 sage: for l in L:
 ....:     print "l =",l
 ....:     x = HierarchyElement(10, l.to_poset())
 ....:     print x.all_bases_controlled_len()
 ....:
 l = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
 19
 l = [10, 9, 8, 7, 6, 5, 4, 3, 1, 2]
 19
 l = [10, 9, 8, 7, 6, 5, 4, 2, 3, 1]
 19
 l = [10, 9, 8, 7, 6, 5, 4, 2, 1, 3]
 19
 l = [10, 9, 8, 7, 6, 5, 4, 1, 3, 2]
 19
 l = [10, 9, 8, 7, 6, 5, 4, 1, 2, 3]
 19
 l = [10, 9, 8, 7, 6, 5, 3, 4, 2, 1]
 18
 ...
 l = [10, 7, 9, 8, 5, 6, 4, 1, 3, 2]
 20
 l = [10, 7, 9, 8, 5, 6, 4, 1, 2, 3]
 20
 l = [10, 7, 9, 8, 5, 6, 3, 4, 2, 1]
 18
 l = [10, 7, 9, 8, 5, 6, 3, 4, 1, 2]
 18
 ...
 l = [10, 7, 9, 8, 4, 5, 6, 1, 3, 2]
 20
 l = [10, 7, 9, 8, 4, 5, 6, 1, 2, 3]
 20
 l = [10, 7, 9, 8, 4, 5, 1, 6, 3, 2]
 17
 l = [10, 7, 9, 8, 4, 5, 1, 6, 2, 3]
 17
 l = [10, 7, 9, 6, 8, 5, 4, 3, 2, 1]
 19
 ...
 l = [10, 7, 9, 6, 8, 5, 4, 1, 2, 3]
 19
 l = [10, 7, 9, 6, 8, 5, 3, 4, 2, 1]
 16
 l = [10, 7, 9, 6, 8, 5, 3, 4, 1, 2]
 16
 l = [10, 7, 9, 6, 8, 4, 5, 3, 2, 1]
 18
 l = [10, 7, 9, 6, 8, 4, 5, 3, 1, 2]
 18
 l = [10, 7, 9, 6, 8, 4, 5, 2, 3, 1]
 18
 l = [10, 7, 9, 6, 8, 4, 5, 2, 1, 3]
 18
 l = [10, 7, 9, 6, 8, 4, 5, 1, 3, 2]
 18
 l = [10, 7, 9, 6, 8, 4, 5, 1, 2, 3]
 18
 l = [10, 7, 9, 6, 8, 4, 2, 5, 3, 1]
 17
 l = [10, 7, 9, 6, 8, 4, 2, 5, 1, 3]
 17
 l = [10, 7, 9, 6, 4, 8, 5, 3, 2, 1]
 19
 l = [10, 7, 9, 6, 4, 8, 5, 3, 1, 2]
 19
 ...
 l = [10, 7, 4, 8, 9, 6, 5, 1, 2, 3]
 19
 l = [10, 7, 4, 8, 9, 6, 2, 5, 3, 1]
 16
 l = [10, 7, 4, 8, 9, 6, 2, 5, 1, 3]
 16
 l = [10, 7, 4, 8, 9, 5, 6, 3, 2, 1]
 18
 l = [10, 7, 4, 8, 9, 5, 6, 3, 1, 2]
 18
 ...
 l = [10, 7, 4, 8, 5, 9, 6, 1, 2, 3]
 17
 l = [10, 7, 4, 8, 5, 9, 1, 6, 3, 2]
 16
 l = [10, 7, 4, 8, 5, 9, 1, 6, 2, 3]
 16
 sage:
 }}}

 I am not surprise that some posets are easier to control than others. Why
 do you expect that `all_bases_controlled_len` is the same in all cases?

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13589#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 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to