[New-bugs-announce] [issue45380] help() appears confused about the module of typing.Annotated
Alex Waygood
report at bugs.python.org
Tue Oct 5 14:29:03 EDT 2021
New submission from Alex Waygood <Alex.Waygood at Gmail.com>:
`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`)
```
----------
assignee: docs at python
components: Documentation, Library (Lib)
messages: 403258
nosy: AlexWaygood, docs at python
priority: normal
severity: normal
status: open
title: help() appears confused about the module of typing.Annotated
type: behavior
versions: Python 3.10, Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45380>
_______________________________________
More information about the New-bugs-announce
mailing list