Skip to content

Commit e79625d

Browse files
Benedikt won, I moved the section ;-)
1 parent 9abbabb commit e79625d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Doc/library/typing.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,18 +1433,20 @@ These can be used as types in annotations. They all support subscription using
14331433
{'x': typing.Annotated[int, 'metadata'], 'return': <class 'NoneType'>}
14341434

14351435
At runtime, the metadata associated with an ``Annotated`` type can be
1436-
retrieved via the :attr:`!__metadata__` attribute. If you want to retrieve
1437-
the original type wrapped by ``Annotated``, use the :attr:`!__origin__` attribute:
1436+
retrieved via the :attr:`!__metadata__` attribute.
14381437

14391438
.. doctest::
14401439

1441-
>>> from typing import Annotated, get_origin
1440+
>>> from typing import Annotated
14421441
>>> X = Annotated[int, "very", "important", "metadata"]
14431442
>>> X
14441443
typing.Annotated[int, 'very', 'important', 'metadata']
14451444
>>> X.__metadata__
14461445
('very', 'important', 'metadata')
14471446

1447+
If you want to retrieve the original type wrapped by ``Annotated``, use the
1448+
:attr:`!__origin__` attribute:
1449+
14481450
.. doctest::
14491451

14501452
>>> from typing import Annotated, get_origin

0 commit comments

Comments
 (0)