#14099: Adding Method for testing avoidance in posets
---------------------------------------------------+------------------------
       Reporter:  chrisjamesberg                   |         Owner:  rowland    
 
           Type:  enhancement                      |        Status:  
needs_review
       Priority:  minor                            |     Milestone:  sage-5.7   
 
      Component:  combinatorics                    |    Resolution:             
 
       Keywords:  posets, days45                   |   Work issues:             
 
Report Upstream:  N/A                              |     Reviewers:  Chris Berg 
 
        Authors:  Eric Rowland, Alejandro Morales  |     Merged in:             
 
   Dependencies:                                   |      Stopgaps:             
 
---------------------------------------------------+------------------------

Comment (by ncohen):

 > What is the advantage of merging them into one?  The disadvantage is a
 decrease in clarity.

 One advantage is that you only have to write documentation and doctests
 for only one function instead of two, and documentation and doctests are
 actually the largest part of this patch. Then 50% of the actual code is
 only there to deal with the input and not actual computations. If you want
 to improve clarity, you can also dramatically decrease the tests you do at
 the beginning. Something like that :

 {{{
 def i_take_lists_of_pairs_or_just_a_pair_as_input(u,v=None):
     if v is None:
         return all(i_take_lists_of_pairs_or_just_a_pair_as_input(*x) for x
 in u)
     u,v = Integer(u), Integer(v)
     if u<0 or v<0:
         raise ValueError("Both elements of a pair must be positive
 integers")
     # No I can do some actual computations
     print u,v
     return True
 }}}

 But honestly I think that only one method (taking a pair as input) should
 exist in Sage. To me the rest is "personal code".

 Nathann

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