Python's mypy has a special function called reveal_type() which asks the linter to display the type of variables.
PyCharm does not support it and instead shows the function as non-existing.
How can I display the type hint of a variable?
By default, PyCharm binds the F1 key to the "display documentation" command.

When displaying the documentation, you're able to see the type of variables, function signatures, class signatures, and docstrings.
You're also able to view the type directly using ctrl+shift+P or by hovering with the mouse and pressing ctrl.
If you do not use the default keymap, you may navigate to View | Quick documentation:

Starting 2025.2, PyCharm will show inlay hints next to reveal_type() calls:
![a = [0] + ['']; reveal_type(a); list[str | int]](https://i.sstatic.net/2sND8YM6.png)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With