Here are some links to Python documentation on the web, but before you branch off and explore these sources read the next section about the help that is available from within python itself.
Python comes with very comprehensive built-in documentation. This is in two kinds. There is the integrated modal sub-system invoked by typing help() at the command line, and there is information about programming elements available from the interpreter itself by typing in python commands such as dir(object).
Python code is documented using Docstrings. These are string literals inserted a specific points in the script. They can be single or multi-line. By convention, all modules, functions and classes should have docstrings which are opened and closed by triple double quotes. Modules should start with a multi docstring structured as follows:
"""a summary line. (followed by a blank line) description of what the module does listing classes, exceptions , and functions etcThe next section covers the Help sub-system mode
When you start the python interpreter it displays three lines of information followed by the standard python command prompt
Python 3.8.8+ (riscos-1, Feb 22 2021, 21:48:54) [GCC 4.7.4] on riscos Type "help", "copyright", "credits" or "license" for more information. >>>
Type help() and the python help utility is invoked. A summary of the help system is printed and the python prompt ">>>" is replaced by "help> ". You can exit the modal help system with a null enter.
At the help> prompt you can get a list of available modules and keywords. Eg.
help> modules _abc _sre easy_install riscos_toolbox .... help> riscos_toolbox Help on package riscos_toolbox: .... help> keywords False class from or .... help> if The "if" statement ....
How to Inspect the contents of a library module
use help(modulename) gives formatted output help(sys) use dir built-in function import sys dir(sys) # shows names defined by sys dir(math) # shows names defined by math or dir() # shows names I have defined use inspect similar to dir but more options import inspect print(inspect.getdoc(inspect)) print(inspect.getcomments(inspect))
© 2021 JR