The display hook for plain Python

This is not used directly in interactive Sage (where we use the IPython system for display hooks). This class provides a way to use the Sage “plain text” display formatting when not using interactive Sage, for example when running doctests.

class sage.repl.display.python_hook.DoctestDisplayHook

Bases: object

Python constructor

EXAMPLES:

sage: from sage.repl.display.python_hook import DoctestDisplayHook
sage: d = DoctestDisplayHook()
sage: d(set([1, 2, 3]))       # Sage commandline output
{1, 2, 3}
sage: print(set([1, 2, 3]))   # Plain Python output
set([1, 2, 3])

Previous topic

Utility functions for pretty-printing

This Page