-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Inconsistent output for optional parameters/attributes #11522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It's funny because this is exactly what I've been doing yesterday. Actually, the reason why the docstring still contains :param bar: ...
:type bar: Optional[str] and left untouched. The
The output would then be
The reason why |
@picnixz two relevant side notes:
|
Describe the bug
The type of an optional parameter in
will be output differently than that of an optional attribute:
or when there's a type annotation on the paramter itself:
How to Reproduce
The following Python sourceode:
when incorporated into a Sphinx project via
.. automodule::
etc. gives the following HTML output:The type annotation
Optional[str]
should be displayed consistently asstr | None
in all three spots, instead of asOptional[str]
for:param:
, andstr | None
for.. attribute
and type annotations in the function signature.Environment Information
Sphinx extensions
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: