[IPython-User] iPython QTConsole - Force yellow quickref guide to appear again?
Mon Sep 10 00:08:55 CDT 2012
On Sat, Sep 8, 2012 at 9:39 PM, Fernando Perez <firstname.lastname@example.org> wrote:
> On Thu, Sep 6, 2012 at 12:07 PM, Francesco Montesano
> <email@example.com> wrote:
>> If I use the ? after the command it does as you, but if I use the help
>> function (help(range), help(plot)) it prints both texts on the
>> The ? has the same behaviour on the qtconsole and the standard ipython
>> terminal, but in the latter the help function opens a pager
>> independently of the length of the docstring (and I personally prefer
>> this way). Would be hard to give the help the same behaviour?
>> I'm tempted to open a feature request in github to pipe the help(...)
>> into the pager
> help() is a builtin function in the standard library, we have no
> control over it. I'm sure we could monkeypatch our way around it, but
> it's not worth the effort: ? is ipython's machinery, and that's where
> we focus our efforts.
I was hoping that you might be able to "trick" help() into using the
qtconsole's pager. It uses a function in pydoc called getpager() (do
"import pydoc" and "pydoc.getpager??" to see it).
It looked like it uses the environment variable "PAGER" if it is
defined. The qtconsole seems to have this defined as 'cat'. I thought
maybe the qtconsole should be change os.environ["PAGER"] from 'cat' to
whatever it uses to emulate less with ? and ?? (what would that be by
the way?). But apparently that's not the issue. getpager() first
checks if type(sys.stdout) is types.FileType (in the qtconsole it is
IPython.zmq.iostream.OutStream, which assumedly is not something that
can be changed). If it isn't, it just uses the regular
sys.stdout.write "pager". So to really trick help(), you'd have to
monkeypatch pydoc.getpager. Or else redefine help() as the same as
the regular help() but using the qtconsole pager. Either way, you're
changing the built-in directly.
If you want, maybe you could open an issue in the CPython bug tracker
for a way to enable the pager even when type(sys.stdout) is not
> IPython-User mailing list
More information about the IPython-User