2000-12-12 21:12:45 -05:00
|
|
|
PEP: 233
|
|
|
|
Title: Python Online Help
|
2022-10-05 12:48:43 -04:00
|
|
|
Author: Paul Prescod <paul@prescod.net>
|
2001-04-18 06:32:43 -04:00
|
|
|
Status: Deferred
|
2000-12-12 21:12:45 -05:00
|
|
|
Type: Standards Track
|
2017-01-07 13:33:00 -05:00
|
|
|
Content-Type: text/x-rst
|
2000-12-12 21:12:45 -05:00
|
|
|
Created: 11-Dec-2000
|
|
|
|
Python-Version: 2.1
|
|
|
|
Post-History:
|
|
|
|
|
|
|
|
|
|
|
|
Abstract
|
2017-01-07 13:33:00 -05:00
|
|
|
========
|
2000-12-12 21:12:45 -05:00
|
|
|
|
2017-01-07 13:33:00 -05:00
|
|
|
This PEP describes a command-line driven online help facility for
|
|
|
|
Python. The facility should be able to build on existing
|
|
|
|
documentation facilities such as the Python documentation and
|
|
|
|
docstrings. It should also be extensible for new types and
|
|
|
|
modules.
|
2000-12-12 21:12:45 -05:00
|
|
|
|
|
|
|
|
2017-01-07 13:33:00 -05:00
|
|
|
Interactive use
|
|
|
|
===============
|
2000-12-12 21:12:45 -05:00
|
|
|
|
2017-04-05 12:14:26 -04:00
|
|
|
Simply typing ``help`` describes the help function (through ``repr()``
|
2017-01-07 13:33:00 -05:00
|
|
|
overloading).
|
2000-12-12 21:12:45 -05:00
|
|
|
|
2017-04-05 12:14:26 -04:00
|
|
|
``help`` can also be used as a function.
|
2000-12-12 21:12:45 -05:00
|
|
|
|
2017-04-05 12:14:26 -04:00
|
|
|
The function takes the following forms of input:
|
2000-12-12 21:12:45 -05:00
|
|
|
|
2017-04-05 12:14:26 -04:00
|
|
|
* ``help( "string" )`` -- built-in topic or global
|
|
|
|
* ``help( <ob> )`` -- docstring from object or type
|
|
|
|
* ``help( "doc:filename" )`` -- filename from Python documentation
|
2000-12-12 21:12:45 -05:00
|
|
|
|
2017-01-07 13:33:00 -05:00
|
|
|
If you ask for a global, it can be a fully-qualified name, such as::
|
2000-12-12 21:12:45 -05:00
|
|
|
|
2017-01-07 13:33:00 -05:00
|
|
|
help("xml.dom")
|
|
|
|
|
|
|
|
You can also use the facility from a command-line::
|
2000-12-12 21:12:45 -05:00
|
|
|
|
|
|
|
python --help if
|
|
|
|
|
2017-04-05 12:14:26 -04:00
|
|
|
In either situation, the output does paging similar to the ``more``
|
2017-01-07 13:33:00 -05:00
|
|
|
command.
|
2000-12-12 21:12:45 -05:00
|
|
|
|
|
|
|
|
|
|
|
Implementation
|
2017-01-07 13:33:00 -05:00
|
|
|
==============
|
2000-12-12 21:12:45 -05:00
|
|
|
|
2017-01-07 13:33:00 -05:00
|
|
|
The help function is implemented in an ``onlinehelp`` module which is
|
|
|
|
demand-loaded.
|
2000-12-12 21:12:45 -05:00
|
|
|
|
2017-01-07 13:33:00 -05:00
|
|
|
There should be options for fetching help information from
|
|
|
|
environments other than the command line through the ``onlinehelp``
|
|
|
|
module::
|
2000-12-12 21:12:45 -05:00
|
|
|
|
2017-01-07 13:33:00 -05:00
|
|
|
onlinehelp.gethelp(object_or_string) -> string
|
2000-12-12 21:12:45 -05:00
|
|
|
|
2017-01-07 13:33:00 -05:00
|
|
|
It should also be possible to override the help display function
|
2017-04-05 12:14:26 -04:00
|
|
|
by assigning to ``onlinehelp.displayhelp(object_or_string)``.
|
2000-12-12 21:12:45 -05:00
|
|
|
|
2017-01-07 13:33:00 -05:00
|
|
|
The module should be able to extract module information from
|
|
|
|
either the HTML or LaTeX versions of the Python documentation.
|
|
|
|
Links should be accommodated in a "lynx-like" manner.
|
2000-12-12 21:12:45 -05:00
|
|
|
|
2017-01-07 13:33:00 -05:00
|
|
|
Over time, it should also be able to recognize when docstrings are
|
|
|
|
in "special" syntaxes like structured text, HTML and LaTeX and
|
|
|
|
decode them appropriately.
|
2000-12-12 21:12:45 -05:00
|
|
|
|
2017-01-07 13:33:00 -05:00
|
|
|
A prototype implementation is available with the Python source
|
2017-04-05 12:14:26 -04:00
|
|
|
distribution as ``nondist/sandbox/doctools/onlinehelp.py``.
|
2000-12-12 21:12:45 -05:00
|
|
|
|
|
|
|
|
|
|
|
Built-in Topics
|
2017-01-07 13:33:00 -05:00
|
|
|
===============
|
|
|
|
|
2017-04-05 12:14:26 -04:00
|
|
|
* ``help( "intro" )`` -- What is Python? Read this first!
|
2017-01-07 13:33:00 -05:00
|
|
|
|
2017-04-05 12:14:26 -04:00
|
|
|
* ``help( "keywords" )`` -- What are the keywords?
|
2017-01-07 13:33:00 -05:00
|
|
|
|
2017-04-05 12:14:26 -04:00
|
|
|
* ``help( "syntax" )`` -- What is the overall syntax?
|
2017-01-07 13:33:00 -05:00
|
|
|
|
2017-04-05 12:14:26 -04:00
|
|
|
* ``help( "operators" )`` -- What operators are available?
|
2017-01-07 13:33:00 -05:00
|
|
|
|
2017-04-05 12:14:26 -04:00
|
|
|
* ``help( "builtins" )`` -- What functions, types, etc. are built-in?
|
2017-01-07 13:33:00 -05:00
|
|
|
|
2017-04-05 12:14:26 -04:00
|
|
|
* ``help( "modules" )`` -- What modules are in the standard library?
|
2000-12-12 21:12:45 -05:00
|
|
|
|
2017-04-05 12:14:26 -04:00
|
|
|
* ``help( "copyright" )`` -- Who owns Python?
|
2017-01-07 13:33:00 -05:00
|
|
|
|
2017-04-05 12:14:26 -04:00
|
|
|
* ``help( "moreinfo" )`` -- Where is there more information?
|
2017-01-07 13:33:00 -05:00
|
|
|
|
2017-04-05 12:14:26 -04:00
|
|
|
* ``help( "changes" )`` -- What changed in Python 2.0?
|
2017-01-07 13:33:00 -05:00
|
|
|
|
2017-04-05 12:14:26 -04:00
|
|
|
* ``help( "extensions" )`` -- What extensions are installed?
|
2017-01-07 13:33:00 -05:00
|
|
|
|
2017-04-05 12:14:26 -04:00
|
|
|
* ``help( "faq" )`` -- What questions are frequently asked?
|
2017-01-07 13:33:00 -05:00
|
|
|
|
2017-04-05 12:14:26 -04:00
|
|
|
* ``help( "ack" )`` -- Who has done work on Python lately?
|
2000-12-12 21:12:45 -05:00
|
|
|
|
|
|
|
|
|
|
|
Security Issues
|
2017-01-07 13:33:00 -05:00
|
|
|
===============
|
|
|
|
|
|
|
|
This module will attempt to import modules with the same names as
|
|
|
|
requested topics. Don't use the modules if you are not confident
|
|
|
|
that everything in your ``PYTHONPATH`` is from a trusted source.
|