Debugger module in Python

Python comes with its own debugger module that is named pdb. This module provides an interactive source code debugger for your Python programs. You can set breakpoints, step through your code, inspect stack frames and more. We will look at the following aspects of the module:

  • How to start the debugger
  • Stepping through your code
  • Setting breakpoints

Let’s start by creating a quick piece of code to attempt debugging with. Here’s a silly example:

Get hands-on with 1200+ tech skills courses.