kernel.core.display_trap

Module: kernel.core.display_trap

Inheritance diagram for IPython.kernel.core.display_trap:

Manager for replacing sys.displayhook().

DisplayTrap

class IPython.kernel.core.display_trap.DisplayTrap(formatters=None, callbacks=None)

Bases: object

Object to trap and format objects passing through sys.displayhook().

This trap maintains two lists of callables: formatters and callbacks. The formatters take the last object that has gone through since the trap was set and returns a string representation. Callbacks are executed on every object that passes through the displayhook and does not return anything.

__init__(formatters=None, callbacks=None)
add_to_message(message)
Add the formatted display of the objects to the message dictionary being returned from the interpreter to its listeners.
clear()
Reset the stored object.
hook(obj)
This method actually implements the hook.
set()
Set the hook.
unset()
Unset the hook.