[issue17158] help() module searcher text improvement

Terry J. Reedy report at bugs.python.org
Mon Feb 11 04:13:17 CET 2013


Terry J. Reedy added the comment:

Looking further at the pydoc code, I see that "Here is a list. Enter any listed item to get more help", with both sentences printed before the list, is normal. Having a post-list prompt for the list of all modules is the exception. So I would no longer make the change proposed in my first patch and would instead look to rewording along the line Senthil suggested.

listmodules(key) calls apropos(key) after printing the header. That function in turn creates a ModuleScanner and calls .run with a callback. So making the prompt conditional on whether or not anything is found would require modification of ModuleScanner.run(), apropos(), and listscanner(). As indicated by my first patch, I agree with Senthil that it is not worth the effort when a better prompt should do.

A deeper problem is this: the prompt "Enter any listed item to get more help." is only valid if one asks for the list in help mode, at the "help> " prompt. If one asks for the list at the normal interpreter ">>> " prompt with "help('xxx')", as described in the original post, then entering the name of the listed item at the next ">>> " prompt is wrong. One should instead wrap the text with "help('" and "')", or enter help() mode first. However, I have not yet discovered a way to detect the context of the list request so that the prompt could be modified.

The Welcome text could also use a couple of changes.
1. It does not mention the new symbol help.
"To get a list of available modules, keywords, or topics, type "modules", "keywords", or "topics".
should include symbols and "symbols".
2. This: '''to list the modules whose summaries contain a given word
such as "spam",'''
is more accurately written as this:
'''to list the modules whose name or summary contain a
given string such as "spam",'''

Attached is a second patch with the easy fixes, without touching the context-prompt issue.

A possible commit message: Add 'symbols' to help welcome message; clarify 'modules spam' messages.

----------
Added file: http://bugs.python.org/file29037/Issue17158-b.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17158>
_______________________________________


More information about the Python-bugs-list mailing list