Skip to content
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

Closed
RamchandraApte mannequin opened this issue Feb 8, 2013 · 6 comments
Closed

help() module searcher text improvement #61360

RamchandraApte mannequin opened this issue Feb 8, 2013 · 6 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@RamchandraApte
Copy link
Mannequin

RamchandraApte mannequin commented Feb 8, 2013

BPO 17158
Nosy @terryjreedy, @orsenthil
Files
  • Issue17158.diff: Move output of 'Enter...'
  • Issue17158-b.diff: Different changes
  • 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:

    assignee = 'https://github.com/terryjreedy'
    closed_at = <Date 2013-02-11.07:23:46.071>
    created_at = <Date 2013-02-08.14:24:19.355>
    labels = ['type-feature', 'library']
    title = 'help() module searcher text improvement'
    updated_at = <Date 2013-02-11.07:26:31.249>
    user = 'https://bugs.python.org/RamchandraApte'

    bugs.python.org fields:

    activity = <Date 2013-02-11.07:26:31.249>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2013-02-11.07:23:46.071>
    closer = 'python-dev'
    components = ['Library (Lib)']
    creation = <Date 2013-02-08.14:24:19.355>
    creator = 'Ramchandra Apte'
    dependencies = []
    files = ['29013', '29037']
    hgrepos = []
    issue_num = 17158
    keywords = ['patch']
    message_count = 6.0
    messages = ['181671', '181715', '181844', '181869', '181874', '181876']
    nosy_count = 4.0
    nosy_names = ['terry.reedy', 'orsenthil', 'python-dev', 'Ramchandra Apte']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue17158'
    versions = ['Python 3.4']

    @RamchandraApte
    Copy link
    Mannequin Author

    RamchandraApte mannequin commented Feb 8, 2013

    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 ..."

    @RamchandraApte RamchandraApte mannequin added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement labels Feb 8, 2013
    @RamchandraApte RamchandraApte mannequin changed the title help() module searcher text improvement help() module searcher text is misleading Feb 8, 2013
    @terryjreedy
    Copy link
    Member

    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.

    @terryjreedy terryjreedy added stdlib Python modules in the Lib dir and removed interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Feb 9, 2013
    @orsenthil
    Copy link
    Member

    You will stumble on that message, only if you give help("module
    <somename>") and note that <somename> could be any module in the
    PYTHONPATH.
    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/pydoc.py

    @orsenthil orsenthil changed the title help() module searcher text is misleading help() module searcher text improvement Feb 10, 2013
    @terryjreedy
    Copy link
    Member

    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.

    @orsenthil
    Copy link
    Member

    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.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Feb 11, 2013

    New changeset 4f84fe5a997b by Terry Jan Reedy in branch 'default':
    Closes bpo-17158: Add 'symbols' to help() welcome message; clarify 'modules spam'
    http://hg.python.org/cpython/rev/4f84fe5a997b

    @python-dev python-dev mannequin closed this as completed Feb 11, 2013
    @terryjreedy terryjreedy self-assigned this Feb 11, 2013
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants