Get function signature right since the beginning

This commit is contained in:
Juan Luis Cano Rodríguez 2021-09-13 15:33:37 +02:00
parent 02119aba8d
commit ae3eab278c
2 changed files with 3 additions and 4 deletions

View File

@ -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

View File

@ -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!