Skip to content

Commit 8af08eb

Browse files
committed
DOC Note on section ordering, and add missing sections
Fixes numpy#68 assuming we do not also want a warning
1 parent e32e363 commit 8af08eb

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

doc/format.rst

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,12 @@ facilitate reading the docstrings in text terminals.
8888

8989
Sections
9090
--------
91-
The sections of the docstring are:
91+
92+
The docstring consists of a number of sections separated by headings (except
93+
for the deprecation warning). Each heading should be underlined in hyphens, and
94+
the section ordering should be consistent with the description below.
95+
96+
The sections of a function's docstring are:
9297

9398
1. **Short summary**
9499

@@ -264,7 +269,16 @@ The sections of the docstring are:
264269
This section should be used judiciously, i.e., only for errors
265270
that are non-obvious or have a large chance of getting raised.
266271

267-
9. **See Also**
272+
9. **Warns**
273+
274+
An optional section detailing which warnings get raised and
275+
under what conditions, formatted similarly to Raises.
276+
277+
10. **Warnings**
278+
279+
An optional section with cautions to the user in free text/reST.
280+
281+
11. **See Also**
268282

269283
An optional section used to refer to related code. This section
270284
can be very useful, but should be used judiciously. The goal is to
@@ -303,7 +317,7 @@ The sections of the docstring are:
303317
func_b, func_c_, func_d
304318
func_e
305319

306-
10. **Notes**
320+
12. **Notes**
307321

308322
An optional section that provides additional information about the
309323
code, possibly including a discussion of the algorithm. This
@@ -348,7 +362,7 @@ The sections of the docstring are:
348362
where filename is a path relative to the reference guide source
349363
directory.
350364

351-
11. **References**
365+
13. **References**
352366

353367
References cited in the **notes** section may be listed here,
354368
e.g. if you cited the article below using the text ``[1]_``,
@@ -373,7 +387,7 @@ The sections of the docstring are:
373387
should not be required to understand it. References are numbered, starting
374388
from one, in the order in which they are cited.
375389

376-
12. **Examples**
390+
14. **Examples**
377391

378392
An optional section for examples, using the `doctest
379393
<http://docs.python.org/library/doctest.html>`_ format.

0 commit comments

Comments
 (0)