Skip to content

[docs] Update common_issues.rst: update information about reveal type & locals #19059

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Aug 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions docs/source/common_issues.rst
Original file line number Diff line number Diff line change
Expand Up @@ -505,11 +505,15 @@ to see the types of all local variables at once. Example:
# b: builtins.str
.. note::

``reveal_type`` and ``reveal_locals`` are only understood by mypy and
don't exist in Python. If you try to run your program, you'll have to
remove any ``reveal_type`` and ``reveal_locals`` calls before you can
run your code. Both are always available and you don't need to import
them.
``reveal_type`` and ``reveal_locals`` are handled specially by mypy during
type checking, and don't have to be defined or imported.

However, if you want to run your code,
you'll have to remove any ``reveal_type`` and ``reveal_locals``
calls from your program or else Python will give you an error at runtime.

Alternatively, you can import ``reveal_type`` from ``typing_extensions``
or ``typing`` (on Python 3.11 and newer)

.. _silencing-linters:

Expand Down