-
-
Notifications
You must be signed in to change notification settings - Fork 31.3k
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
gh-124269: Simplify typing.Annotated
docs
#130770
base: main
Are you sure you want to change the base?
Conversation
I forgot about this one. If Jelle approves the PR today, go ahead and merge it, or I'll review it tomorrow. |
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
@picnixz friendly ping :-) |
I'm currently travelling so I don't have time to review sorry. Nikita/Alex could also review the PR but I trust Jelle's judgment on this one so if he wants to merge it, go ahead. I can review it when I'm at the airport in a few hours though |
* At runtime, the metadata associated with an ``Annotated`` type can be | ||
retrieved via the :attr:`!__metadata__` attribute: | ||
At runtime, the metadata associated with an ``Annotated`` type can be | ||
retrieved via the :attr:`!__metadata__` attribute. If you want to retrieve |
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.
To avoid mixing examples, I would prefer a separate paragraph for origin, namely;
Paragraph for metadata
Example
One line of text for origin
Example
Or at least two distinct doctest blocks.
|
||
* The order of the metadata elements is preserved and matters for equality | ||
checks:: | ||
assert a1 != a2 # Order matters |
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.
assert a1 != a2 # Order matters | |
assert a1 != a2 # Order matters |
.. doctest:: | ||
|
||
>>> from typing import Annotated, get_origin |
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.
I think this import is still needed but I'm not entirely sure. Because Annotated may not be imported when executing the block test
Grouped relevant bullet points into paragraphs. Maybe I took too many creative liberties...
Request: @JelleZijlstra @sobolevn @picnixz
typing.Annotated
docs #124269