Most of the Python developers reading this book might already be aware of the usage of pdb, that is, the Python debugger. For those who are not aware of it, pdb is an interactive source code debugger for Python programs. We can set breakpoints wherever needed, debug using single-stepping at the source line level, and inspect the stack frames.
Many new developers might be of the opinion that the job of a debugger can be handled using a logger, but debuggers provide a much deeper insight into the flow of control and preserve the state at each step, and hence, save a lot of development time.
We will use Python's built-in pdb module for this recipe and use it in our application from the last recipe.