Title: help() module searcher text improvement
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.4
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: Ramchandra Apte, orsenthil, python-dev, terry.reedy
Priority: normal Keywords: patch

Created on 2013-02-08 14:24 by Ramchandra Apte, last changed 2013-02-11 07:26 by terry.reedy. This issue is now closed.

File name Uploaded Description Edit
Issue17158.diff terry.reedy, 2013-02-09 03:28 Move output of 'Enter...' review
Issue17158-b.diff terry.reedy, 2013-02-11 03:13 Different changes review
Messages (6)
msg181671 - (view) Author: Ramchandra Apte (Ramchandra Apte) * Date: 2013-02-08 14:24
help("modules spam") prints out "Here is a list of matching modules.  Enter any module name to get more help." before it has even found the modules. This gives the impression that it has found the modules yet it hasn't printed the modules yet. I would suggest that it prints "Searching for the matching modules..." without the newline and then once the matching modules have been found prints "done." (End result will have "Searching for the matchine modules... done." Then it should print "Here is a list of matching modules. Enter any ..."
msg181715 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013-02-09 03:28
You are asking that help("modules spam") act more like help("modules"), which sensibly prints "Enter ..." after the list. A minor but reasonable request, but since the current behavior is not a bug and some code might possible depend on it, only for 3.4. Here is a simple but untested patch.
msg181844 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2013-02-10 19:43
You will stumble on that message, only if you give help("module
<somename>") and note that <somename> could be any module in the
We can change to show the text only if the module is a valid module,
but I think, it is costly do that computation for help text. A better
approach would be:
Modules matching the keyword: <somemodule>

The output can be a list or None.

If you will like to work on a patch, the changes will be in listmodule
function in Lib/
msg181869 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013-02-11 03:13
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, 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.
msg181874 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2013-02-11 06:46
The patch looks good to me. This change is helpful and definitely an improvement over the existing text. Please go ahead with committing it, Terry. Thanks.
msg181876 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-02-11 07:23
New changeset 4f84fe5a997b by Terry Jan Reedy in branch 'default':
Closes #17158: Add 'symbols' to help() welcome message; clarify 'modules spam'
Date User Action Args
2013-02-11 07:26:31terry.reedysetassignee: terry.reedy
2013-02-11 07:23:46python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg181876

resolution: fixed
stage: patch review -> resolved
2013-02-11 06:46:49orsenthilsetmessages: + msg181874
2013-02-11 03:13:17terry.reedysetfiles: + Issue17158-b.diff

messages: + msg181869
2013-02-10 19:43:32orsenthilsetnosy: + orsenthil

messages: + msg181844
title: help() module searcher text is misleading -> help() module searcher text improvement
2013-02-09 03:28:12terry.reedysetfiles: + Issue17158.diff

components: + Library (Lib), - Interpreter Core
versions: - Python 3.3
keywords: + patch
nosy: + terry.reedy

messages: + msg181715
stage: patch review
2013-02-08 14:24:57Ramchandra Aptesettitle: help() module searcher text improvement -> help() module searcher text is misleading
2013-02-08 14:24:19Ramchandra Aptecreate