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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs: In param lists mark up multiple types correctly #116389
base: main
Are you sure you want to change the base?
Docs: In param lists mark up multiple types correctly #116389
Conversation
Use the word 'or' instead of the symbol '|'.
My first reaction was "but these aren't valid Python type hints anymore!" My second reaction was to go... "Wait, he's right, these are probably much more readable for casual readers of the documentation who might not be familiar with Python's typing system" :) |
|
||
:param exc_info: An exception tuple with the current exception information, | ||
as returned by :func:`sys.exc_info`, | ||
or ``None`` if no exception information is available. | ||
:type exc_info: tuple[type[BaseException], BaseException, types.TracebackType] | None | ||
:type exc_info: tuple[type[BaseException], BaseException, types.TracebackType] or None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this one still perhaps a bit too complex for the docs? Not sure how it could be simplified, though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is definitely complex. In this case, I'd say readability is definitely improved using or
iso. |
.
I checked the first one:
Both are linked and marked up the same. Are there some instances where there's a difference (other than "|" vs. "or")? Should we be formatting None as |
@hugovk: indeed, it looks like they are all the same. I also tried just using a comma ( |
No strong preference either way. In theory, if Sphinx says to do it one way, it makes sense to do that. In practice, if it makes no difference, let's pick the one we prefer. So I'll leave it up to you ;) |
It's a minor style issue to decide on, nevertheless it feels wrong for me to decide on the convention in a PR. I think at least a heads-up in the Documentation category on Discourse would be nice :) UPDATE: I created a topic on Discourse. |
Marked as draft until a decision has been made. |
Use the word 'or' instead of the symbol '|'.
See also the Sphinx docs:
馃摎 Documentation preview 馃摎: https://cpython-previews--116389.org.readthedocs.build/