[Numpy-discussion] Matlab -> NumPy translation and indexing

Alexander Michael lxander.m@gmail....
Tue Mar 20 07:27:17 CDT 2007

On 3/20/07, David Koch <ogdude@googlemail.com> wrote:
> And by the way - whenever I do a <function>.__doc__ all newline characters
> are printed as "\n" in the python console ... how do I change that?

The easiest way to access the doc strings is to type help(<function>)
in the python interpreter, or ?<function> in ipython

The reason you are seeing the escaped newlines is that by directly
accessing the __doc__ attribute, you are getting the string which the
interpreter is kind enough to display in repr form,  but you are not
explicitly printing it (in str form). Compare:

>>> print repr('hello\nworld')
>>> print str('hello\nworld')

So that if you said print <function>.__doc__, you would not see the
escaped newlines.

More information about the Numpy-discussion mailing list