Title: pydoc topics, keywords and symbols always use pager instead of output
Type: behavior Stage: patch review
Components: Library (Lib) Versions: Python 3.8
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: eht16
Priority: normal Keywords: patch

Created on 2019-08-04 12:48 by eht16, last changed 2019-08-04 12:55 by eht16.

Pull Requests
URL Status Linked Edit
PR 15105 open eht16, 2019-08-04 12:55
Messages (1)
msg348983 - (view) Author: Enrico Tröger (eht16) * Date: 2019-08-04 12:48
I noticed a probably unintended behavior in help() usage:

when an output is set on pydoc.Helper(), most of its methods
use this output instead of a pager.
But 'True', 'False' and 'None' as well as all topics, keywords
and symbols always use a pager instead of the configured output.

My use case is to use the pydoc help system to display help contents
in Geany (a text editor) in a graphical manner
(and so I cannot make any use of a pager).

Example code:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from io import StringIO
import pydoc
import sys

if __name__ == '__main__':
    help_text = StringIO()

    helper = pydoc.Helper(output=help_text)
    # help contents are written to help_text as expected'pydoc')

    # the following calls each show the help contents in a pager instead
    # of using the configured output'True')'False')'None')'**')  # symbol example'SEQUENCES')  # topic example'await')  # keyword example

Tested against Python 3.7.3.
Date User Action Args
2019-08-04 12:55:23eht16setkeywords: + patch
stage: patch review
pull_requests: + pull_request14847
2019-08-04 12:48:20eht16create