Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Only the first string would be considered the docstring of the function. Also, it has to come <strong>after</strong> the def, not before.</p> <pre><code>&gt;&gt;&gt; def bar(): ... """My function. ... ... That does foo. ... """ ... pass ... &gt;&gt;&gt; bar.__doc__ 'My function.\n \n That does foo.\n ' &gt;&gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt; def bar(): ... "My function.\n" ... "\n" ... "That does foo.\n" ... pass ... &gt;&gt;&gt; bar.__doc__ 'My function.\n' </code></pre> <p>Based on the example in your question, you're probably looking for "<strong>additional docstrings</strong>". From <a href="http://www.python.org/dev/peps/pep-0257/" rel="nofollow">PEP 257</a>:</p> <blockquote> <p>String literals occurring elsewhere in Python code may also act as documentation. They are <strong>not recognized by the Python bytecode compiler and are not accessible as runtime object attributes (i.e. not assigned to <code>__doc__</code>)</strong>, but two types of extra docstrings may be extracted by software tools:</p> <ol> <li>String literals occurring immediately after a simple assignment at the top level of a module, class, or <code>__init__</code> method are called "attribute docstrings".</li> <li>String literals <strong>occurring immediately after another docstring</strong> are called "additional docstrings".</li> </ol> </blockquote> <p><a href="http://www.python.org/dev/peps/pep-0257/" rel="nofollow">PEP 258</a> -- Docutils Design Specification gives more information on attribute and <a href="http://www.python.org/dev/peps/pep-0258/#additional-docstrings" rel="nofollow">additional docstrings</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload