#11775: Make pretty_print take multiple arguments
--------------------------------------+-------------------------------------
    Reporter:  ppurka                 |         Owner:  jason       
        Type:  enhancement            |        Status:  needs_review
    Priority:  major                  |     Milestone:  sage-4.8    
   Component:  misc                   |    Resolution:              
    Keywords:  pretty print           |   Work_issues:              
    Upstream:  N/A                    |      Reviewer:  Keshav Kini 
      Author:  Punarbasu Purkayastha  |        Merged:              
Dependencies:                         |  
--------------------------------------+-------------------------------------
Changes (by ppurka):

  * status:  needs_work => needs_review
  * work_issues:  Fix notebook "typeset" =>
  * milestone:  => sage-4.8


Old description:

> The pretty_print function currently takes only one argument. This somehow
> makes it difficult to print multiple things in one line, for instance the
> following is currently not possible:
> {{{
> A = identity_matrix(2); pretty_print("A = ", A)
> }}}
> with the output being "A = <the matrix A on the same line>"
>
> I am attaching a patch which allows pretty_print to take in multiple
> arguments. It is based on some code by _leif @ #sagemath (See
> http://sagenb.org/home/pub/3111/ ). Also kini @ #sagemath helped in
> passing the doctests.
>
> The modifications are to 1) the function pretty_print 2) the doctests in
> pretty_print 3) the doctest in pretty_print_default (whitespace issues)
>
> -----
>
> Apply [attachment:trac_11775-pretty_print_multiple_args.2.patch] to the
> Sage library.

New description:

 The pretty_print function currently takes only one argument. This somehow
 makes it difficult to print multiple things in one line, for instance the
 following is currently not possible:
 {{{
 A = identity_matrix(2); pretty_print("A = ", A)
 }}}
 with the output being "A = <the matrix A on the same line>"

 I am attaching a patch which allows pretty_print to take in multiple
 arguments. It is based on some code by _leif @ #sagemath (See
 http://sagenb.org/home/pub/3111/ ). Also kini @ #sagemath helped in
 passing the doctests.

 The modifications are to 1) the function pretty_print 2) the doctests in
 pretty_print 3) the doctest in pretty_print_default (whitespace issues)

 -----

 Apply [attachment:trac_11775-pretty_print_multiple_args.3.patch] to the
 `SAGE_ROOT/devel/sage`.

--

Comment:

 Updated patch to make it work with Typeset on or off, and also take in
 multiple arguments. Passes doctests: `../../sage -t -long ./sage/misc`.

 The `view()`, `tuple_function()`, `latex()` and `JSMath()` in
 `devel/sage/sage/misc/latex.py` have been updated to take in an extra
 argument `combine_all`. The way it works is:

 1. if `combine_all` is `True` then the string returned by `tuple_function`
 does not return a tuple and it instead combines all the elements it
 receives. It ''does not'' collapse a tuple inside a tuple.

 2. if `combine_all` is `False` (the default) then everything behaves as
 earlier.

 3. `combine_all` is passed as `True` from `pretty_print` whenever it calls
 the `view()` function.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11775#comment:23>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to