New submission from Alex Waygood <alex.wayg...@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@python
components: Documentation, Library (Lib)
messages: 403258
nosy: AlexWaygood, docs@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue45380>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to