Reputation: 26901
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?
Upvotes: 4
Views: 1604
Reputation: 26901
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:
Upvotes: 6