summaryrefslogtreecommitdiffstats
path: root/Doc/library/pydoc.rst
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-12-27 19:11:15 (GMT)
committerGeorg Brandl <georg@python.org>2008-12-27 19:11:15 (GMT)
commit1ffbfbc5666cc304ca00c6da297431e9d2aee6a1 (patch)
tree8b9e8c12f04058cec1da5673e43204a79a107099 /Doc/library/pydoc.rst
parent6b28f394a241b445c4fcf43732eb1b8afa47a88e (diff)
downloadcpython-1ffbfbc5666cc304ca00c6da297431e9d2aee6a1.zip
cpython-1ffbfbc5666cc304ca00c6da297431e9d2aee6a1.tar.gz
cpython-1ffbfbc5666cc304ca00c6da297431e9d2aee6a1.tar.bz2
#4671: document that pydoc imports modules.
Diffstat (limited to 'Doc/library/pydoc.rst')
-rw-r--r--Doc/library/pydoc.rst7
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/library/pydoc.rst b/Doc/library/pydoc.rst
index 6d4986e..3784515 100644
--- a/Doc/library/pydoc.rst
+++ b/Doc/library/pydoc.rst
@@ -36,6 +36,13 @@ it contains the path separator for your operating system, such as a slash in
Unix), and refers to an existing Python source file, then documentation is
produced for that file.
+.. note::
+
+ In order to find objects and their documentation, :mod:`pydoc` imports the
+ module(s) to be documented. Therefore, any code on module level will be
+ executed on that occasion. Use an ``if __name__ == '__main__':`` guard to
+ only execute code when a file is invoked as a script and not just imported.
+
Specifying a :option:`-w` flag before the argument will cause HTML documentation
to be written out to a file in the current directory, instead of displaying text
on the console.