@@ -1039,31 +1039,28 @@ blank, visually separating the summary from the rest of the description. The
10391039following lines should be one or more paragraphs describing the object's calling
10401040conventions, its side effects, etc.
10411041
1042- The Python parser does not strip indentation from multi-line string literals in
1043- Python, so tools that process documentation have to strip indentation if
1044- desired. This is done using the following convention. The first non-blank line
1045- *after * the first line of the string determines the amount of indentation for
1046- the entire documentation string. (We can't use the first line since it is
1047- generally adjacent to the string's opening quotes so its indentation is not
1048- apparent in the string literal.) Whitespace "equivalent" to this indentation is
1049- then stripped from the start of all lines of the string. Lines that are
1050- indented less should not occur, but if they occur all their leading whitespace
1051- should be stripped. Equivalence of whitespace should be tested after expansion
1052- of tabs (to 8 spaces, normally).
1042+ The Python parser strips indentation from multi-line string literals when they
1043+ serve as module, class, or function docstrings.
10531044
10541045Here is an example of a multi-line docstring::
10551046
10561047 >>> def my_function():
10571048 ... """Do nothing, but document it.
10581049 ...
1059- ... No, really, it doesn't do anything.
1050+ ... No, really, it doesn't do anything:
1051+ ...
1052+ ... >>> my_function()
1053+ ... >>>
10601054 ... """
10611055 ... pass
10621056 ...
10631057 >>> print(my_function.__doc__)
10641058 Do nothing, but document it.
10651059
1066- No, really, it doesn't do anything.
1060+ No, really, it doesn't do anything:
1061+
1062+ >>> my_function()
1063+ >>>
10671064
10681065
10691066.. _tut-annotations :
0 commit comments