help(typing.Annotated[foo, ...]) should return the doc for _AnnotatedAlias
Open
Nobody has claimed this yet.
topic-typing
type-bug
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 36k
- PR merge metrics
- PR metrics pending
Description
Split off from #89543; the module issue is fixed but other issues raised in the comments still remain valid. For the following code
>>> from typing import Annotated, Callable
>>> t = Annotated[int | str, "Some metadata"]
>>> help(t)
Help on _AnnotatedAlias in module typing:
Annotated = int | str
We should arguably ignore the instance and return the same thing as help(typing._AnnotatedAlias), analogously to help(int | str) returning the docs for Union
Linked PRs
- gh-97813
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproduced help(typing.Annotated[...]) behavior and compare it with help(typing._AnnotatedAlias) and help(int | str). The change is done when the Annotated instance returns the _AnnotatedAlias documentation rather than the current instance-specific output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- developer-experience
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100