| OLD | NEW |
| 1 :mod:`pydoc` --- Documentation generator and online help system | 1 :mod:`pydoc` --- Documentation generator and online help system |
| 2 =============================================================== | 2 =============================================================== |
| 3 | 3 |
| 4 .. module:: pydoc | 4 .. module:: pydoc |
| 5 :synopsis: Documentation generator and online help system. | 5 :synopsis: Documentation generator and online help system. |
| 6 .. moduleauthor:: Ka-Ping Yee <ping@lfw.org> | 6 .. moduleauthor:: Ka-Ping Yee <ping@lfw.org> |
| 7 .. sectionauthor:: Ka-Ping Yee <ping@lfw.org> | 7 .. sectionauthor:: Ka-Ping Yee <ping@lfw.org> |
| 8 | 8 |
| 9 | 9 |
| 10 .. index:: | 10 .. index:: |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 Unix), and refers to an existing Python source file, then documentation is | 33 Unix), and refers to an existing Python source file, then documentation is |
| 34 produced for that file. | 34 produced for that file. |
| 35 | 35 |
| 36 .. note:: | 36 .. note:: |
| 37 | 37 |
| 38 In order to find objects and their documentation, :mod:`pydoc` imports the | 38 In order to find objects and their documentation, :mod:`pydoc` imports the |
| 39 module(s) to be documented. Therefore, any code on module level will be | 39 module(s) to be documented. Therefore, any code on module level will be |
| 40 executed on that occasion. Use an ``if __name__ == '__main__':`` guard to | 40 executed on that occasion. Use an ``if __name__ == '__main__':`` guard to |
| 41 only execute code when a file is invoked as a script and not just imported. | 41 only execute code when a file is invoked as a script and not just imported. |
| 42 | 42 |
| 43 Specifying a :option:`-w` flag before the argument will cause HTML documentation | 43 Specifying a ``-w`` flag before the argument will cause HTML documentation |
| 44 to be written out to a file in the current directory, instead of displaying text | 44 to be written out to a file in the current directory, instead of displaying text |
| 45 on the console. | 45 on the console. |
| 46 | 46 |
| 47 Specifying a :option:`-k` flag before the argument will search the synopsis | 47 Specifying a ``-k`` flag before the argument will search the synopsis |
| 48 lines of all available modules for the keyword given as the argument, again in a | 48 lines of all available modules for the keyword given as the argument, again in a |
| 49 manner similar to the Unix :program:`man` command. The synopsis line of a | 49 manner similar to the Unix :program:`man` command. The synopsis line of a |
| 50 module is the first line of its documentation string. | 50 module is the first line of its documentation string. |
| 51 | 51 |
| 52 You can also use :program:`pydoc` to start an HTTP server on the local machine | 52 You can also use :program:`pydoc` to start an HTTP server on the local machine |
| 53 that will serve documentation to visiting Web browsers. :program:`pydoc` | 53 that will serve documentation to visiting Web browsers. :program:`pydoc` |
| 54 :option:`-p 1234` will start a HTTP server on port 1234, allowing you to browse | 54 ``-p 1234`` will start a HTTP server on port 1234, allowing you to browse |
| 55 the documentation at ``http://localhost:1234/`` in your preferred Web browser. | 55 the documentation at ``http://localhost:1234/`` in your preferred Web browser. |
| 56 :program:`pydoc` :option:`-g` will start the server and additionally bring up a | 56 :program:`pydoc` ``-g`` will start the server and additionally bring up a |
| 57 small :mod:`tkinter`\ -based graphical interface to help you search for | 57 small :mod:`tkinter`\ -based graphical interface to help you search for |
| 58 documentation pages. | 58 documentation pages. |
| 59 | 59 |
| 60 When :program:`pydoc` generates documentation, it uses the current environment | 60 When :program:`pydoc` generates documentation, it uses the current environment |
| 61 and path to locate modules. Thus, invoking :program:`pydoc` :option:`spam` | 61 and path to locate modules. Thus, invoking :program:`pydoc spam` |
| 62 documents precisely the version of the module you would get if you started the | 62 documents precisely the version of the module you would get if you started the |
| 63 Python interpreter and typed ``import spam``. | 63 Python interpreter and typed ``import spam``. |
| 64 | 64 |
| 65 Module docs for core modules are assumed to reside in | 65 Module docs for core modules are assumed to reside in |
| 66 http://docs.python.org/library/. This can be overridden by setting the | 66 http://docs.python.org/library/. This can be overridden by setting the |
| 67 :envvar:`PYTHONDOCS` environment variable to a different URL or to a local | 67 :envvar:`PYTHONDOCS` environment variable to a different URL or to a local |
| 68 directory containing the Library Reference Manual pages. | 68 directory containing the Library Reference Manual pages. |
| 69 | 69 |
| OLD | NEW |