##// END OF EJS Templates
Merge pull request #4515 from Carreau/load-speedup...
Merge pull request #4515 from Carreau/load-speedup Spring Cleaning, and Load speedup 0) prompt '*' strore fix + tab remove tooltip tab was not cancelling tooltip bringing to cases where you could have tooltip andcompleter open. Do not store '*' when serializing cells. get rid of most slowdown at notebook loading. 1) Do not setOption('mode',new_mode) on CM if new and old mode are the same. It triggert a lot of calculation of bounding box in the end. 2) Do not select cell when loading the notebook it triggers a lot of CM even that check visible things and so on and so forth. So add a option to add_cell_at_index not to select it 3) jQuery $.attr has some magics, but has a slight overhead on real native ELEM.setAttribute DOM method. Seem slight improvement when loads of PNGs on one page

File last commit:

r11729:5cc34183
r13580:af808396 merge
Show More
integrating.rst
44 lines | 1.5 KiB | text/x-rst | RstLexer

Integrating your objects with IPython

Tab completion

To change the attributes displayed by tab-completing your object, define a __dir__(self) method for it. For more details, see the documentation of the built-in dir() function.

Rich display

The notebook and the Qt console can display richer representations of objects. To use this, you can define any of a number of _repr_*_() methods. Note that these are surrounded by single, not double underscores.

Both the notebook and the Qt console can display svg, png and jpeg representations. The notebook can also display html, javascript, and latex. If the methods don't exist, or return None, it falls back to a standard repr().

For example:

class Shout(object):
    def __init__(self, text):
        self.text = text

    def _repr_html_(self):
        return "<h1>" + self.text + "</h1>"

Custom exception tracebacks

Rarely, you might want to display a different traceback with an exception - IPython's own parallel computing framework does this to display errors from the engines. To do this, define a _render_traceback_(self) method which returns a list of strings, each containing one line of the traceback.

Please be conservative in using this feature; by replacing the default traceback you may hide important information from the user.