From ae3eab278cc39e6d54d3b8f08802e3d7bb4592b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Luis=20Cano=20Rodr=C3=ADguez?= Date: Mon, 13 Sep 2021 15:33:37 +0200 Subject: Get function signature right since the beginning --- doc/tutorial/automatic-doc-generation.rst | 3 +-- doc/tutorial/describing-code.rst | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'doc/tutorial') 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! -- cgit v1.2.1