@@ -11,13 +11,50 @@ 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+ An inline comment is a comment on the same line as a statement. Inline
26+ comments should be separated by at least two spaces from the statement.
27+ They should start with a # and a single space.
28+ Inline comments are unnecessary and in fact distracting if they state
29+ the obvious. Don't do this:
30+ x = x + 1 # Increment x
31+ But sometimes, this is useful:
32+ x = x + 1 # Compensate for border
1633
1734Doc Strings
1835-----------
36+ PEP 257 is the primary reference for docstrings. (http://www.python.org/dev/peps/pep-0257/)
37+ There are two types of docstrings, one-line and multi-line. Their names should be fairly self explanatory.
38+ One-line docstrings: ::
39+
40+ def kos_root():
41+ """Return the pathname of the KOS root directory."""
42+ global _kos_root
43+ if _kos_root: return _kos_root
44+ ...
45+
46+ Multi-line docstrings: ::
47+
48+ def complex(real=0.0, imag=0.0):
49+ """Form a complex number.
1950
51+ Keyword arguments:
52+ real -- the real part (default 0.0)
53+ imag -- the imaginary part (default 0.0)
2054
55+ """
56+ if imag == 0.0 and real == 0.0: return complex_zero
57+ ...
2158
2259Sphinx
2360::::::
0 commit comments