$$\newcommand{\tp}{\thinspace .}$$

# Debugging in Python

Hans Petter Langtangen [1, 2]

[1] Center for Biomedical Computing, Simula Research Laboratory
[2] Department of Informatics, University of Oslo

#### Mar 23, 2015

Testing a program to find errors usually takes much more time than to write the code. This document is devoted to tools and good habits for effective debugging. The section Using a debugger describes the Python debugger, a key tool for examining the internal workings of a code, while the section How to debug explains how solve problems and write software to simplify the debugging process.

Much of the material in this document is taken from Appendix F in the book A Primer on Scientific Programming with Python, 4th edition, by the same author, published by Springer, 2014.