@@ -11,13 +11,51 @@ The Basics
1111
1212Code Comments
1313-------------
14-
15-
14+ Information regarding code comments is taken from PEP 008 (http://www.python.org/dev/peps/pep-0008/).
15+ Block comment styling should be used when commenting out multiple lines of code.: ::
16+
17+ Block comments generally apply to some (or all) code that follows them,
18+ and are indented to the same level as that code. Each line of a block
19+ comment starts with a # and a single space (unless it is indented text
20+ inside the comment).
21+ Paragraphs inside a block comment are separated by a line containing a
22+ single #.
23+
24+ Inline comments are used for individual lines and should be used sparingly.: ::
25+
26+ An inline comment is a comment on the same line as a statement. Inline
27+ comments should be separated by at least two spaces from the statement.
28+ They should start with a # and a single space.
29+ Inline comments are unnecessary and in fact distracting if they state
30+ the obvious. Don't do this:
31+ x = x + 1 # Increment x
32+ But sometimes, this is useful: ::
33+ x = x + 1 # Compensate for border
1634
1735Doc Strings
1836-----------
37+ PEP 257 is the primary reference for docstrings. (http://www.python.org/dev/peps/pep-0257/)
38+ |There are two types of docstrings, one-line and multi-line. Their names should be fairly self explanatory.
39+ |One-line docstrings: ::
40+
41+ def kos_root():
42+ """Return the pathname of the KOS root directory."""
43+ global _kos_root
44+ if _kos_root: return _kos_root
45+ ...
46+
47+ Multi-line docstrings: ::
48+
49+ def complex(real=0.0, imag=0.0):
50+ """Form a complex number.
1951
52+ Keyword arguments:
53+ real -- the real part (default 0.0)
54+ imag -- the imaginary part (default 0.0)
2055
56+ """
57+ if imag == 0.0 and real == 0.0: return complex_zero
58+ ...
2159
2260Sphinx
2361::::::
0 commit comments