Summary
This chapter explained a few different debugging techniques and gotchas. There is, of course, much more that can be said about debugging, but I hope you have acquired a nice vantage point for debugging your Python code now. Interactive debugging techniques are very useful for single-threaded applications and locations where interactive sessions are available. But since that's not always the case, we also discussed some non-interactive options.
Here's an overview of all the points discussed in this chapter:
- Non-interactive debugging using:
print
logging
trace
traceback
asyncio
faulthandler
- Interactive debugging using both
pdb
andipdb
In the next chapter, we will see how to monitor and improve both CPU and memory performance, as well as finding and fixing memory leaks.