[Python-ideas] Cleaner separation of help() and interactive help.
Ron Adam
rrr at ronadam.com
Mon Feb 7 21:21:45 CET 2011
Currently any call to help() uses the pager in pydoc. Because of that, you
can't do some things (easily) like...
>>> result = help(thing)
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.
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.
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.
Separating these even more might be good, ... help() and ihelp(). In this
case, the current help() function could just be renamed to ihelp(), and a
new help() function would return a result as a string. The default might
be help(thing='help'). The help on 'help' would refer to 'ihelp' for the
interactive help.
Sometime later, I want to look into moving the pager in pydoc to the cmd
module as cmd.pager(). (I think it fits well there.)
And related to that... I am going to look into re-implementing pydocs
interactive help with the cmd module. I think it will remove some
duplication, and both modules will benefit.
Cheers,
Ron
More information about the Python-ideas
mailing list