Warning
This documentation is for an old version of IPython. You can find docs for newer versions here.
Displayhook for IPython.
This defines a callable class that IPython uses for sys.displayhook.
Authors:
Bases: IPython.config.configurable.Configurable
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.
Parameters: | result : object
|
---|---|
Returns: | (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.
Parameters: | format_dict : dict
md_dict : dict (optional)
|
---|
Write the output prompt.
The default implementation simply writes the prompt to io.stdout.