[Python-ideas] Cleaner separation of help() and interactive help.

Steven D'Aprano steve at pearwood.info
Mon Feb 7 23:24:09 CET 2011


Ron Adam wrote:
> 
> Currently any call to help() uses the pager in pydoc.  Because of that, 
> you can't do some things (easily) like...
> 
>  >>> result = help(thing)

I've not often needed to do that, not enough to really care, and the few 
times I have wanted it, result = thing.__doc__ was good enough. But I 
can see that it might occasionally be useful.

But not enough to make it the default behaviour of help()! Something 
like one of these might be good though:

result = help(thing, interactive=False)
result = help(thing, pager=None)



> It also can be annoying (to me) when I use help and the result is 
> cleared after the pager is done with it.  That requires me to re-do the 
> same help requests to recheck details rather than simply scroll back in 
> the current console window.

Really? I find that a feature, not an annoyance. Otherwise, I'd have to 
scroll back to recheck results in the console window.


> The alternative is to keep another console open just for using help. 
> That's not always good when you already have multiple windows open for 
> doing other things.

Then what's the problem with one more tab in your xterm app?


> In python 3.3, I would like to have help() return the results as a 
> string, and only use the pager if you are actually in interactive-help 
> mode.
> 
>  >>> help(thing)   # return a help string of a thing.
> 
>  >>> help()        # enter interactive help mode where the pager is used.

-1.

I use help(thing) dozens of times a session, and help() on its own maybe 
a handful of times a year. Why would I want to get half a page of 
instructions *every single time* I use help() when I can just say 
help(thing) and go straight to the part I care about?

I sympathize with your desire for a way to get help to return the text 
rather than feed it through a pager, but don't want it to be the default.



-- 
Steven



More information about the Python-ideas mailing list