Home

Search IconIcon to open search

Python debugging

From Andrej Karpathy:

debugging in Python:

  • print()s alone: too simple
  • import pdb; pdb.set_trace(): too complex
  • import code; code.interact(local=locals()): just right simply drops you into interpreter, perfect for 95% of debugging

Tutorial: How To Debug Python with an Interactive Console.

There’s also breakpoint(): Python breakpoint().