### Navigation

- index
- modules |
- next |
- previous |
- IPython 0.10.2 documentation »
- The IPython API »

# generics

## Module: `generics`

‘Generic’ functions for extending IPython.

See http://cheeseshop.python.org/pypi/simplegeneric.

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).

## Functions

`IPython.generics.``complete_object`()

  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.

`IPython.generics.``inspect_object`()

  Called when you do obj?

`IPython.generics.``result_display`()

  print the result of computation

### Navigation

- index
- modules |
- next |
- previous |
- IPython 0.10.2 documentation »
- The IPython API »