Rather than distinguishing the different backends, I was more worried about how 
to keep what related doctests currently give us. For example, in 
src/doc/fr/tutorial/latex.rst, pretty_print is advertised as a way to obtain 
nicely formatted MathJax output:

    sage: pretty_print(x^12)
    <html><script 
type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}x^{12}</script></html>

I suppose this is exactly what is used in the notebook to format the output. If 
the default display mode was `plain`, I would not know how to rephrase this 
doctest other than changing the display mode before and after the test, which 
is suboptimal in the tutorials.

Admittedly though, with the command line backend, the same command outputs

    sage: pretty_print(x^12)
    \newcommand{\Bold}[1]{\mathbf{#1}}x^{12}

so arguably a dichotomy is already there. With display mode `plain`, we get

    sage: pretty_print(x^12)
    x^12

which is the same as just printing the object.

It seems generally difficult, if not impossible, to write tests for different 
backends, as we only use the doctest backend during doctests. Though, I assume 
that the MathJax output is sufficiently tested elsewhere, so changing the 
default behavior of pretty_print for the commandline and doctests should not be 
a problem after all.


> Am 30.01.2020 um 22:21 schrieb Nils Bruin <nbr...@sfu.ca>:
> 
> On Thursday, January 30, 2020 at 1:17:14 PM UTC-8, Nils Bruin wrote:
> prints as 'The Sage display manager using the IPython command line backend' 
> and 'The Sage display manager using the IPython notebook backend' 
> respectively, so they're already distinguishable. Setting different defaults 
> in these different cases doesn't seem like a problem to me.
> 
> Oops, and as the documentation of display_manager says, in doctests, you get 
> back: 'The Sage display manager using the doctest backend', so there's a 
> third one! Perhaps we should try and keep that one aligned with the command 
> line, since those both communicate through character streams (whereas the 
> notebook one communicates through a message passing interface) 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/B3C05557-4D6F-4B5F-9ABA-4493A5CDBB2E%40gmail.com.

Reply via email to