Message403258
`help()` appears confused about the module of `typing.Annotated`. If you call `help()` on a parameterised "instance" of `typing.Annotated`, it will claim that `Annotated` belongs to whatever module the annotated type is from. Additionally, `help()` appears not to know about the `__metadata__` attribute of `typing.Annotated`.
```
>>> from typing import Annotated, Callable
>>> t = Annotated[int | str, "Some metadata"]
>>> help(t)
Help on _AnnotatedAlias in module types:
Annotated = int | str
>>> u = Annotated[Callable[[int], str], "Some metadata"]
>>> help(u)
Help on _AnnotatedAlias in module typing:
Annotated = typing.Callable[[int], str]
>>> s = Annotated[int, "Some metadata"]
Help on _AnnotatedAlias in module builtins:
Annotated = class int(object)
| int([x]) -> integer
| int(x, base=10) -> integer
# (etc., giving the entire output of help() for `int`)
``` |
|
Date |
User |
Action |
Args |
2021-10-05 18:29:03 | AlexWaygood | set | recipients:
+ AlexWaygood, docs@python |
2021-10-05 18:29:03 | AlexWaygood | set | messageid: <1633458543.21.0.19270161871.issue45380@roundup.psfhosted.org> |
2021-10-05 18:29:03 | AlexWaygood | link | issue45380 messages |
2021-10-05 18:29:03 | AlexWaygood | create | |
|