Sometimes you see a light bulb that appears automatically, when you place the caret at a certain location in your code. What does it mean?
The yellow light bulb means that PyCharm suggests to alter your code. This happens, when no errors are encountered, but you can do something to improve your code, for example, add a documentation comment. The other option is a so-called "create from usage". For example, you refer to a method that does not yet exist, and PyCharm suggests to create it.
The red light bulb means that PyCharm has run into an error, and suggests to fix it. For example, if an import statement is required, or a resource is missing, PyCharm suggests a quick way to fix these problems.
There can be numerous types of modifications or fixes, and they are shown in a suggestion list. To bring the suggestion list forward, you can:
- Click the bulb icon
- Press Alt+Enter
To learn more about the intention actions, refer to the section Intention Actions of online help.