def doc_sub(*sub):
def dec(obj):<EOL><INDENT>obj.__doc__ = obj.__doc__.format(*sub)<EOL>return obj<EOL><DEDENT>return dec<EOL>
Decorator for performing substitutions in docstrings.

Using @doc_sub(some_note, other_note) on a function with {0} and {1} in the
docstring will substitute the contents of some_note and other_note for {0}
and {1}, respectively.

Decorator appears to work properly both with IPython help (tab completion
and ?) and with Sphinx.