Skip to content

Feature: reveal_type should work from comments #8864

Closed
@ramalho

Description

@ramalho

It would be great if reveal_type could be called from comments.

Mypy already looks at various comments to do its job, and reveal_type is not a runtime function, it only exists during a type check.

While experimenting with type hints in test code, I could write this:

a = some_func() # reveal_type(a)

Instead of:

a = some_func()
if typing.TYPE_CHECKING:
    reveal_type(a)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions