This documentation is for a development version of IPython. There may be significant differences from the latest stable release (1.1.0).
Displayhook for IPython.
This defines a callable class that IPython uses for sys.displayhook.
The custom IPython displayhook to replace sys.displayhook.
This class does many things, but the basic idea is that it is a callable that gets called anytime user code returns a value.
Check if the user has set the ‘_’ variable by hand.
Compute format data of the object to be displayed.
The format data is a generalization of the repr() of an object. In the default implementation the format data is a dict of key value pair where the keys are valid MIME types and the values are JSON’able data structure containing the raw data for that MIME type. It is up to frontends to determine pick a MIME to to use and display that data in an appropriate manner.
This method only computes the format data for the object and should NOT actually print or write that to a stream.
result : object
(format_dict, md_dict) : dict
Finish up all displayhook activities.
Log the output.
Should we silence the display hook because of ‘;’?
Start the displayhook, initializing resources.
Update user_ns with various things like _, __, _1, etc.
Write the format data dict to the frontend.
This default version of this method simply writes the plain text representation of the object to io.stdout. Subclasses should override this method to send the entire format_dict to the frontends.
format_dict : dict
md_dict : dict (optional)
Write the output prompt.
The default implementation simply writes the prompt to io.stdout.