Stepping functionalities

Stepping functionalities are a way to control how the execution of your program should proceed. Going from left to right in the toolbar, we have the following functionalities:

Let's look at some of these functionalities in action:

  1. With the execution of our example program currently at line 3 (where the built-in input() function is used), click on the step into  button, and you will see that the parse.py file, which implements the input() function, is opened in the editor, and the execution moves to the first line of the quote() method in that file.

    Again, this functionality is quite useful when you'd like to inspect built-in or external APIs that you are not familiar with.
  2. Now, click on the step out  button, and the execution will return to our own code. Here, the console is waiting for our input, so simply enter a number and move forward with our debugging session. Note that after entering your input, other built-in files might be opened in the editor by PyCharm. This is because the step into button is still active. Simply use the step out button until you get back to our example file, which should now look similar to the following:
Inline debugging inside a function
  1. Let's focus on the current inline debugging output inside our change_middle() function: at line 1, we can see the value of the my_list parameter that's been passed to the function, which is the list [0, 1, 2]; at line 3, we can see the value of the x variable that's been entered by the user from the console.
    Again, this inline debugging feature is significantly helpful, especially in large functions and programs where there are many values for the debugging programmer to keep track of.
  2. We have discussed the most common stepping functionalities in support for debugging purposes in PyCharm. For now, simply step through the rest of the example program using either the resume button or the step over button.

In the rest of this section, we will look into more advanced features when it comes to keeping track of variables.