python / python/mypy

(📚) What do all the symbols mean in the output of `reveal_type`

Open
#11,519 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation priority-0-high
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

Documentation

reveal_type("shaking")  # Literal["shaking"]?

reveal_type(int("1"))  # builtins.int*

from typing import TypeVar
T = TypeVar("T")
def foo(t: T) -> T:
    reveal_type(t)  # T`-1

What do all these wacky symbols mean *, ? and

`-1

I'm guessing there might be others as well.

I looked through the docs and couldn't find anything about it.

Also <: and :>, maybe also def(int) -> str and def().

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reveal_type examples in the issue and inspect the existing mypy documentation for type-display output. Determine the meaning of the shown symbols and identify any additional symbols that should be covered. Done means the documentation explains the notation, including *, ?, -1, <: and :>.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.