step out pdb python 1

step out pdb python

# first (r = return)
(pdb) r 

#then (n = next)
(pdb) n

Here is what the above code is Doing:
1. We import the pdb module.
2. We set a trace using pdb.set_trace().
3. We call the function test() which in turn calls another function divide().
4. The code execution stops at the line that contains the call to pdb.set_trace().
5. We type the command ‘next’ to go to the next line in the current function.
6. We type the command ‘return’ to exit the current function.
7. We type the command ‘next’ to go to the next line in the current function.
8. We type the command ‘quit’ to quit the debugger.

Similar Posts