Skip to content

Add pydoc command #13

@jchristgit

Description

@jchristgit

The standard library has a module pydoc which can be used for generating and viewing documentation. I suggest a command such as [prefix] pydoc <NAME> which calls pydoc.doc with the given name to show instant documentation. I feel like this could be useful when referring to a certain method when helping someone - here's an example with str.find:

>>> import io
>>> import pydoc
>>> out = io.StringIO()
>>> pydoc.doc('str.find', output=out)
>>> print(out.getvalue())
Python Library Documentation: method_descriptor in str

str.find = find(...)
    S.find(sub[, start[, end]]) -> int
    
    Return the lowest index in S where substring sub is found,
    such that sub is contained within S[start:end].  Optional
    arguments start and end are interpreted as in slice notation.
    
    Return -1 on failure.

for "bigger" documentation such as help(dict), this generates quite the long output. It might be a good idea to truncate this or put it into a "pageable embed" (with reactions to move around). Also, I've yet to figure out if it's somehow possible to include a link to the official docs..

Metadata

Metadata

Assignees

Labels

t: featureNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions