New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
help() module searcher text improvement #61360
Comments
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 ..." |
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. |
You will stumble on that message, only if you give help("module The output can be a list or None. If you will like to work on a patch, the changes will be in listmodule |
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.
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. |
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. |
New changeset 4f84fe5a997b by Terry Jan Reedy in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: