‘Generic’ functions for extending IPython.
Here is an example from genutils.py:
- def print_lsstring(arg):
- “Prettier (non-repr-like) and more informative printer for LSString” print “LSString (.p, .n, .l, .s available). Value:” print arg
print_lsstring = result_display.when_type(LSString)(print_lsstring)
(Yes, the nasty syntax is for python 2.3 compatibility. Your own extensions can use the niftier decorator syntax introduced in Python 2.4).
Custom completer dispatching for python objects
obj is the object itself. prev_completions is the list of attributes discovered so far.
This should return the list of attributes in obj. If you only wish to add to the attributes already discovered normally, return own_attrs + prev_completions.
Called when you do obj?
print the result of computation