### Navigation

- index
- modules |
- next |
- previous |
- IPython v0.10.1 documentation »
- The IPython API »

# strdispatch

## Module: `strdispatch`

Inheritance diagram for `IPython.strdispatch`:

String dispatch class to match regexps and dispatch commands.

## `StrDispatch`

class `IPython.strdispatch.``StrDispatch`

  Bases: `object`

  Dispatch (lookup) a set of strings / regexps for match.

  Example:

      >>> dis = StrDispatch()
      >>> dis.add_s('hei',34, priority = 4)
      >>> dis.add_s('hei',123, priority = 2)
      >>> dis.add_re('h.i', 686)
      >>> print list(dis.flat_matches('hei'))
      [123, 34, 686]

  `__init__`()
  `add_re`()

    Adds a target regexp for dispatching

  `add_s`()

    Adds a target ‘string’ for dispatching

  `dispatch`()

    Get a seq of Commandchain objects that match key

  `flat_matches`()

    Yield all ‘value’ targets, without priority

  `s_matches`()

### Navigation

- index
- modules |
- next |
- previous |
- IPython v0.10.1 documentation »
- The IPython API »