2

I am running python-mode with iPython in emacs. Especially with numpy packages, when I type

[1]: help(numpy.array)

or anything similar in the interactive buffer, pages and pages of documentation are printed in the buffer, making it difficult to search through the other material printed in the buffer. Is there a better way to go about this? In R, you can display help pages in a web browser (the documents are on local HD) very easily by changing options(help_type="html"), and there the document is formatted nicely also. Is there anything like this in Python, or what do you do? I don't always have an internet connection so I'd like a local HD solution please.

hatmatrix
  • 42,883
  • 45
  • 137
  • 231

2 Answers2

2

if you use ipython alone (not inside emacs) it should paginate the text out of the box. if not, probably the environment variable PAGER has been overwritten: se it to "less" and it should work

For the bash shell, add to your ~/.bashrc these lines:

export PAGER=less
export LESS=-r

if you want html help you may consider pydoc

import pydoc
pydoc.apropos('numpy.array')
furins
  • 4,979
  • 1
  • 39
  • 57
1

pydoc is probably what you are looking for.

You can have pydoc run its own web server to display documentation with the -p flag (which takes a port number like 1234). For me, it displays documentation for all of the modules in my PYTHONPATH, which is very convenient.

Fredrick Brennan
  • 7,079
  • 2
  • 30
  • 61
  • Thanks, I did `!pydoc -p 1234 &` in iPython buffer, but help still prints in same buffer – hatmatrix Jan 14 '13 at 03:04
  • @crippledlambda Yes, there's (currently) no way to change that. You can search through the local documentation in the browser. – Fredrick Brennan Jan 14 '13 at 03:17
  • Isn't the `pydoc -p` command supposed to open the local documentation in the browser, or I'm misunderstanding what it's supposed to do? – hatmatrix Jan 14 '13 at 12:17