@@ -119,6 +119,8 @@ The sections of a function's docstring are:
119119
120120 """
121121
122+ .. highlight :: rst
123+
1221242. **Deprecation warning **
123125
124126 A section (use if applicable) to warn users that the object is deprecated.
@@ -250,13 +252,21 @@ The sections of a function's docstring are:
250252 Support for the **Yields ** section was added in `numpydoc
251253 <https://github.com/numpy/numpydoc> `_ version 0.6.
252254
253- 7. **Other Parameters **
255+ 7. **Receives **
256+
257+ Explanation of parameters passed to a generator's ``.send() `` method,
258+ formatted as for Parameters, above. Since, like for Yields and Returns, a
259+ single object is always passed to the method, this may describe either the
260+ single parameter, or positional arguments passed as a tuple. If a docstring
261+ includes Receives it must also include Yields.
262+
263+ 8. **Other Parameters **
254264
255265 An optional section used to describe infrequently used parameters.
256266 It should only be used if a function has a large number of keyword
257267 parameters, to prevent cluttering the **Parameters ** section.
258268
259- 8 . **Raises **
269+ 9 . **Raises **
260270
261271 An optional section detailing which errors get raised and under
262272 what conditions::
@@ -269,55 +279,55 @@ The sections of a function's docstring are:
269279 This section should be used judiciously, i.e., only for errors
270280 that are non-obvious or have a large chance of getting raised.
271281
272- 9 . **Warns **
282+ 10 . **Warns **
273283
274284 An optional section detailing which warnings get raised and
275285 under what conditions, formatted similarly to Raises.
276286
277- 10 . **Warnings **
287+ 11 . **Warnings **
278288
279- An optional section with cautions to the user in free text/reST.
289+ An optional section with cautions to the user in free text/reST.
280290
281- 11 . **See Also **
291+ 12 . **See Also **
282292
283- An optional section used to refer to related code. This section
284- can be very useful, but should be used judiciously. The goal is to
285- direct users to other functions they may not be aware of, or have
286- easy means of discovering (by looking at the module docstring, for
287- example). Routines whose docstrings further explain parameters
288- used by this function are good candidates.
293+ An optional section used to refer to related code. This section
294+ can be very useful, but should be used judiciously. The goal is to
295+ direct users to other functions they may not be aware of, or have
296+ easy means of discovering (by looking at the module docstring, for
297+ example). Routines whose docstrings further explain parameters
298+ used by this function are good candidates.
289299
290- As an example, for ``numpy.mean `` we would have::
300+ As an example, for ``numpy.mean `` we would have::
291301
292- See Also
293- --------
294- average : Weighted average
302+ See Also
303+ --------
304+ average : Weighted average
295305
296- When referring to functions in the same sub-module, no prefix is
297- needed, and the tree is searched upwards for a match.
306+ When referring to functions in the same sub-module, no prefix is
307+ needed, and the tree is searched upwards for a match.
298308
299- Prefix functions from other sub-modules appropriately. E.g.,
300- whilst documenting the ``random `` module, refer to a function in
301- ``fft `` by
309+ Prefix functions from other sub-modules appropriately. E.g.,
310+ whilst documenting the ``random `` module, refer to a function in
311+ ``fft `` by
302312
303- ::
313+ ::
304314
305- fft.fft2 : 2-D fast discrete Fourier transform
315+ fft.fft2 : 2-D fast discrete Fourier transform
306316
307- When referring to an entirely different module::
317+ When referring to an entirely different module::
308318
309- scipy.random.norm : Random variates, PDFs, etc.
319+ scipy.random.norm : Random variates, PDFs, etc.
310320
311- Functions may be listed without descriptions, and this is
312- preferable if the functionality is clear from the function name::
321+ Functions may be listed without descriptions, and this is
322+ preferable if the functionality is clear from the function name::
313323
314- See Also
315- --------
316- func_a : Function a with its description.
317- func_b, func_c_, func_d
318- func_e
324+ See Also
325+ --------
326+ func_a : Function a with its description.
327+ func_b, func_c_, func_d
328+ func_e
319329
320- 12 . **Notes **
330+ 13 . **Notes **
321331
322332 An optional section that provides additional information about the
323333 code, possibly including a discussion of the algorithm. This
@@ -362,7 +372,7 @@ The sections of a function's docstring are:
362372 where filename is a path relative to the reference guide source
363373 directory.
364374
365- 13 . **References **
375+ 14 . **References **
366376
367377 References cited in the **notes ** section may be listed here,
368378 e.g. if you cited the article below using the text ``[1]_ ``,
@@ -374,7 +384,7 @@ The sections of a function's docstring are:
374384 and neural-network techniques," Computers & Geosciences, vol. 22,
375385 pp. 585-588, 1996.
376386
377- which renders as
387+ which renders as [ 1 ]_:
378388
379389 .. [1 ] O. McNoleg, "The integration of GIS, remote sensing,
380390 expert systems and adaptive co-kriging for environmental habitat
@@ -393,7 +403,9 @@ The sections of a function's docstring are:
393403 docstring, the table markup will be broken by numpydoc processing. See
394404 `numpydoc issue #130 <https://github.com/numpy/numpydoc/issues/130 >`_
395405
396- 14. **Examples **
406+ .. highlight :: pycon
407+
408+ 15. **Examples **
397409
398410 An optional section for examples, using the `doctest
399411 <http://docs.python.org/library/doctest.html> `_ format.
@@ -413,6 +425,14 @@ The sections of a function's docstring are:
413425 >>> np.add([1, 2], [3, 4])
414426 array([4, 6])
415427
428+ The example code may be split across multiple lines, with each line after
429+ the first starting with '... '::
430+
431+ >>> np.add([[1, 2], [3, 4]],
432+ ... [[5, 6], [7, 8]])
433+ array([[ 6, 8],
434+ [10, 12]])
435+
416436 For tests with a result that is random or platform-dependent, mark the
417437 output as such::
418438
@@ -456,6 +476,7 @@ The sections of a function's docstring are:
456476 `matplotlib.sphinxext.plot_directive ` is loaded as a Sphinx extension in
457477 ``conf.py ``.
458478
479+ .. highlight :: rst
459480
460481Documenting classes
461482-------------------
@@ -493,7 +514,9 @@ In general, it is not necessary to list class methods. Those that are
493514not part of the public API have names that start with an underscore.
494515In some cases, however, a class may have a great many methods, of
495516which only a few are relevant (e.g., subclasses of ndarray). Then, it
496- becomes useful to have an additional **Methods ** section::
517+ becomes useful to have an additional **Methods ** section:
518+
519+ .. code-block :: python
497520
498521 class Photo (ndarray ):
499522 """
0 commit comments