#18238: Options ignored in show() of 3D objects
-------------------------+-------------------------------------------------
       Reporter:         |        Owner:
  egourgoulhon           |       Status:  needs_work
           Type:         |    Milestone:  sage-6.7
  defect                 |   Resolution:
       Priority:  major  |    Merged in:
      Component:         |    Reviewers:  Volker Braun
  graphics               |  Work issues:
       Keywords:         |       Commit:
        Authors:  Eric   |  ff3731d4078f7db2caf2b62cb8cc45b777753ef9
  Gourgoulhon            |     Stopgaps:
Report Upstream:  N/A    |
         Branch:         |
  public/18238           |
   Dependencies:         |
-------------------------+-------------------------------------------------
Changes (by ncohen):

 * status:  positive_review => needs_work


Comment:

 Hello,

 > As I said, that is not desirable here since we might change the viewer
 depending on UI capabilities.
 >
 > There should be some framework for keyword options, especially for
 plottig options, that can deal with this. But right now we have nothing
 better than passing dictionaries around, so we can't easily validate if
 '''some''' viewer uses an argument or not.

 We do not have to validate it in this function. Here is an example

 {{{
 def viewerA(some_option=4):
     print "Plot with some_option={}".format(some_option)

 def viewerB(some_other_option=4):
     print "Plot with some_other_option={}".format(some_other_option)

 def plot(viewer="A",**args):
     r"""
     Plot an object with the selected viewer.

     All other options are forwarded to the actual viewer. See their
     documentation for more information.
     """
     if viewer=="A":
         viewerA(**args)
     elif viewer=="B":
         viewerB(**args)
     else:
         raise ValueError("viewer must be A or B")
 }}}

 As you can see no verification is done in the generic 'plot'. Then,
 everything works as expected:

 {{{
 sage: plot("A",some_option=4)
 Plot with some_option=4
 sage: plot("B",some_other_option=4)
 Plot with some_other_option=4
 sage: plot("A",some_other_option=4)
 ...
 TypeError: viewerA() got an unexpected keyword argument
 'some_other_option'
 }}}

 Nathann

--
Ticket URL: <http://trac.sagemath.org/ticket/18238#comment:9>
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to