No types in "Paramters" list when using Python type annotation

5 views
Skip to first unread message

c.b...@posteo.jp

unread,
Jun 29, 2023, 11:32:53 AM6/29/23
to Sphinx users
Hello,

in the past my python docstrings looked like this.

def foobar(val):
"""

Args:
val (str): A value.
"""

The resulting HTML output looked OK to me. The "str" type is shown in
the "Paramters::" list.

Today I tried type annotation and removed the "str" from the docstring.

def foobar(val: str):
"""

Args:
val: A value.
"""

This results in an HTML output using "str" in the functions signature
"foobar(val: str)" but not in the "Paramters::" list.
Is it possible to modify this behavior and also stick to type
annotations?

Kind
Christian
Reply all
Reply to author
Forward
0 new messages