[IPython-dev] %page help(x)
Mark Voorhies
mark.voorhies at ucsf.edu
Wed Oct 26 16:33:10 EDT 2011
On Thursday, October 13, 2011 07:36:39 pm Fernando Perez wrote:
> On Thu, Oct 13, 2011 at 6:59 PM, Mark Voorhies <mark.voorhies at ucsf.edu> wrote:
> > P.S.: If I get this working, is it worth a pull request, or is this the sort of thing
> > that should live in personal magic?
>
> I never use help myself, so I'd never really cared. But I now see
> that in the qtconsole, help() is kind of useless, because it doesn't
> know how to page. It's going to be equally useless in the notebook.
>
> So perhaps the right solution is to build our own replacement for the
> built-in help(), that is smarter about the clients it's in and that in
> the long run could also format doctrings into html with TeX, etc...
>
> I don't know how far you want to take it, but there's definitely
> potential here to improve the situation regarding interactive help.
> I'd suggest you play with it locally first, and if you think you do
> want to build something more robust/general, then we'd definitely be
> happy to take a PR for it.
>
> Cheers,
>
> f
>
Sounds good. For the impatient, here's a naive working version:
def magic_help(self, s):
"""Retrieve the pydoc help for an object and display it through a pager.
"""
info = self._ofind(s)
if info['found']:
import pydoc
page.page(pydoc.plain(pydoc.render_doc(info["obj"])))
else:
print 'Object `%s` not found' % s
--Mark
More information about the IPython-dev
mailing list