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