#11490: Add a thematic tutorial on coercion and categories
---------------------------------------------------------+------------------
       Reporter:  SimonKing                              |         Owner:  
mvngu                              
           Type:  enhancement                            |        Status:  
needs_review                       
       Priority:  major                                  |     Milestone:  
sage-5.7                           
      Component:  documentation                          |    Resolution:       
                              
       Keywords:  categories coercion thematic tutorial  |   Work issues:       
                              
Report Upstream:  N/A                                    |     Reviewers:  
Vincent Delecroix, Travis Scrimshaw
        Authors:  Simon King                             |     Merged in:       
                              
   Dependencies:  #14084                                 |      Stopgaps:       
                              
---------------------------------------------------------+------------------

Comment (by dimpase):

 Replying to [comment:39 SimonKing]:
 > Replying to [comment:38 dimpase]:
 > > Replying to [comment:37 dimpase]:
 > > > Would it be possible to include the complete code for {{{MyFrac}}},
 as an appendix, with line numbers? Otherwise not all things are
 illustrated by code, e.g. 'You are encouraged to make your parent
 “unique”' paragraph lets the reader wonder how exactly this can be
 accomplished.  If there was such an appendix, you could say there 'see
 lines such-and-such of the appendix'. You could also replace some code
 snippets with such references then.
 > >
 > > Oops,  the code after the line 'Last, we add a method that returns the
 characteristic of the field.'
 > > inherits from {{{UniqueRepresentation}}}. But it was easy to overlook,
 as my previous comment shows :)
 >
 > But I ''explicitly'' state in the text
 > {{{
 > You are encouraged to make your parent “unique”. That’s to say, parents
 should only evaluate equal if they are identical. Sage provides frameworks
 to create unique parents. We use here the most easy one: Inheriting from
 the class sage.structure.unique_representation.UniqueRepresentation is
 enough. Making parents unique can be quite important for an efficient
 implementation, because the repeated creation of “the same” parent would
 take a lot of time.
 > }}}
 >
 > Do you really think this is not enough?
 >

 The confusion comes from the fact that you explain the code '''before'''
 showing the code. There is also an inconsistency in the exposition, as you
 have the line
 {{{
 sage: from sage.rings.ring import Field
 }}}
 but no similar line for {{{UniqueRepresentation}}}. I guess I might have
 waited for {{{sage.structure.unique_representation}}} to show up in the
 code, but it didn't.
 Call me dyslexic :-).


 > > Also, it's hard to see  how  {{{MyFrac}}} and  {{{MyElement}}} fit
 together without a complete listing...
 >
 > OK. The didactic approach is to develop the example step by step. But I
 think having the complete code in the appendix would be nice. Is there an
 automated way to typeset the code with linenumbers?

 After some trial and error upon reading [http://sphinx-
 doc.org/markup/code.htm Sphinx manual],
 I found that the following will work with sphinx in Sage:
 {{{
 .. highlight:: python
    :linenothreshold: 2

 ::

    x = 2
    y = [1,2]
    x = y

 .. highlight:: python
    :linenothreshold: 22222

 }}}
 the 1st {{{highlight::}}} turns on line numberings for fragments with 2 or
 more lines, and the 2nd {{{highlight::}}} effectively turns it off.

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