diff options
author | Juan Luis Cano RodrÃguez <hello@juanlu.space> | 2021-09-13 15:33:37 +0200 |
---|---|---|
committer | Juan Luis Cano RodrÃguez <hello@juanlu.space> | 2021-09-13 15:33:37 +0200 |
commit | ae3eab278cc39e6d54d3b8f08802e3d7bb4592b7 (patch) | |
tree | 5a9effeb4bf605a77bae5342fe23eba3c578ddc5 | |
parent | 02119aba8d6f8eea370f6b0cffe7ece3c3e7d373 (diff) | |
download | sphinx-git-ae3eab278cc39e6d54d3b8f08802e3d7bb4592b7.tar.gz |
Get function signature right since the beginning
-rw-r--r-- | doc/tutorial/automatic-doc-generation.rst | 3 | ||||
-rw-r--r-- | doc/tutorial/describing-code.rst | 4 |
2 files changed, 3 insertions, 4 deletions
diff --git a/doc/tutorial/automatic-doc-generation.rst b/doc/tutorial/automatic-doc-generation.rst index ead741780..df42c6434 100644 --- a/doc/tutorial/automatic-doc-generation.rst +++ b/doc/tutorial/automatic-doc-generation.rst @@ -28,8 +28,7 @@ To use autodoc, first add it to the list of enabled extensions: ] Next, move the content of the ``.. py:function`` directive to the function -docstring in the original Python file and add an optional ``kind`` argument, -as follows: +docstring in the original Python file, as follows: .. code-block:: python :caption: lumache.py diff --git a/doc/tutorial/describing-code.rst b/doc/tutorial/describing-code.rst index a34810f40..d57b48261 100644 --- a/doc/tutorial/describing-code.rst +++ b/doc/tutorial/describing-code.rst @@ -178,7 +178,7 @@ function ``get_random_ingredients`` like this: .. code-block:: python :caption: lumache.py - def get_random_ingredients(): + def get_random_ingredients(kind=None): return ["eggs", "bacon", "spam"] You can now run ``make doctest`` to execute the doctests of your documentation. @@ -214,7 +214,7 @@ for easy examination. It is now time to fix the function: :caption: lumache.py :emphasize-lines: 2 - def get_random_ingredients(): + def get_random_ingredients(kind=None): return ["shells", "gorgonzola", "parsley"] And finally, ``make test`` reports success! |