Python code insight
The PyCharm editor respects highlighting of the keywords, comments, parameters, type hints, and other elements.
The particular highlighting colors are defined in the Editor | Color Scheme page of the Settings dialog.
With new Python versions, PyCharm supports more specific types and language structures,for example, Python 3.10 specific pattern matching:
PyCharm supports Code completion.
As PyCharm indexes your whole project on each startup, it allows you to autocomplete any existing entity wherever it is defined.
PyCharm can find and highlight various problems, locate dead code, find probable bugs, spelling problems, and hint some Python specific improvements, and align the code structure.
As soon as the IDE finds a way to improve your code, it displays a yellow bulb icon in the editor next to the current line. You can also press Alt+Enter to invoke the context actions menu.
For example, you can invert an if statement with a condition.
For more information, refer to Intention actions.
Navigating to declaration
PyCharm allows you to navigate to a location where a particular named code reference has been first declared: place the caret at the symbol in the editor and press Control+B:
Show expression type
While analyzing your code, you often need to identify the type of a particular expression. Consider the following code:
Press Control+Shift+P and select the target expression from the list.
The expression type will be shown in the tooltip.
To preview the definition of the selected expression, press Control and hover over the expression.
You can also use Find Action Control+Shift+A and start typing
Checking regular expressions
If your code contains a regular expression, there is an intention action to check it: place the caret at the regular expression and press Alt+Enter. The RegExp checker shows up, and you have to type the string. If your string doesn't match, the background is red; if it does - green:
For more information, refer to this section.
Viewing reference documentation
With PyCharm, you don’t need to surf the web every time you stumble across some alias, or search your whole application for a method declaration you can’t remember. Place the caret at a keyword you want to look up, and press Control+Q:
For more information, refer to Quick Documentation.