KEMBAR78
Remove the * for inferred types from reveal_type output · Issue #10076 · python/mypy · GitHub
Skip to content

Remove the * for inferred types from reveal_type output #10076

@JelleZijlstra

Description

@JelleZijlstra

Currently, mypy adds a * in reveal_type() output when a type is inferred rather than explicit. This has a couple of problems:

  • I'm not sure what it's useful for. It might be nice to be able to understand how mypy arrived at a type, but it's not obvious to most users what it means for a type to be "inferred" and I personally have never found the distinction useful.
  • It periodically confuses users who see it and don't know what it means (e.g., very recently in a typing-sig thread about missing TypedDict fields)
  • PEP 646 is set to introduce a new meaning for * related to typing, which will make mypy's usage here even more confusing.

I propose that we simply drop the * from reveal_type output, but I'm happy to be convinced otherwise if there are good reasons to keep it.

Looks like the logic for adding the * is in https://github.com/python/mypy/blob/master/mypy/types.py#L2079.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions