-
-
Notifications
You must be signed in to change notification settings - Fork 110
Closed
Description
Consider the following function, which features a parameter that has a default value:
def foobar(name, surname='Smith'):
"""
This is an example.
:type name: str
:type surname: str
:param name: The name of the user.
:param surname: The surname of the user.
"""
If sphinx-autodoc-typehints is configured with
typehints_defaults = 'comma'
typehints_use_signature = True
, the mere existence of the default value makes the extension disregard the type information that is present in the docstring:

Ideally, if the parameter provides a default value but not a type hint, the type information in the docstring should be used if it is present:

Important
The issue is reproducible if typehints_defaults
is set to 'comma'
or 'braces'
, but not if set to 'braces-after'
.
Metadata
Metadata
Assignees
Labels
No labels