#13605: Partition options and cleanup partitions documentation
-----------------------------------------------+----------------------------
       Reporter:  tscrim                       |         Owner:  sage-combinat
           Type:  enhancement                  |        Status:  needs_review 
       Priority:  major                        |     Milestone:  sage-5.7     
      Component:  combinatorics                |    Resolution:               
       Keywords:  partition, options, output   |   Work issues:               
Report Upstream:  N/A                          |     Reviewers:  Andew Mathas 
        Authors:  Travis Scrimshaw             |     Merged in:               
   Dependencies:  #13074 #13762 #13840 #10193  |      Stopgaps:               
-----------------------------------------------+----------------------------

Comment (by andrew.mathas):

 Hi Travis,

 One aspect of the options code that I don't like at the moment is that
 some of the options are only accessible if you change or set the
 corresponding global option. For example, there are five different options
 for TeX-ing partitions (and friends) but there is no easy way for an
 external class to access these individual options.

 I can see three alternatives here:

  1. Don't worry about this and leave everything as it is.
  1. Have the option as a optionable argument to the method using something
 like:
 {{{#!python
 def _latex_(self, latex=None):
     if latex is None: latex=partition_options['latex']
     ...
 }}}
  This has the advantage that it won't be necessary to have a plethora of
 minor variations for the different options of the method.
  1. Implement each option as a separate method as has been done for _repr_
 and then define the optionable method using something like
 {{{#!python
 def _latex_(self):
     return getattr(self,'_latex_'+self.options['latex'])()
 }}}
  This has the advantage that you could check generically to see whether an
 option was a valid option by checking
 hasattr(self,'_latex_'+self.options['latex']) when the option is changed.

 The reason that I care about this is that I have a class which wants to
 use particular TeX and display options for partitions -- namely, a class
 for displaying matrices which which have rows and columns indexed by
 particular partitions. As it is currently written, the only way that ,y
 class will able to access the latex methods it wants is by playing silly
 games with partition_options. As partitions and tableaux are widely used
 as indices I would think that there will be other examples eventually.

 A second point, as above, I think that none of the "option clients" should
 ever access partition_options and tableau_options directly. Rather, they
 should call self.options() or self.parent().options() to do this.

 Let me know what you think about these. I can fold your answer into my
 review patch.

 Andrew

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