I’m sure the Astral tools are all very useful but, controversial opinion here, my preferred way to debug Python code is by reading and understanding it…

@jonathanhogg

Knuth wrote an essay called something like “The bugs of TeX”, that opened with, “On June XX, 197x, I finished writing TeX. The next morning, I began to single step it using the excellent debugger written by ….”

And I thought, “Whoa. Don Knuth single-stepped TeX. Well, if it’s good enough for Knuth, it’s good enough for me.”

And ever since, often the first execution of a program I write takes place in the debugger, one statement at a time.

(With exceptions for Lisp, where single-stepping is an alien concept, so I try to keep my functions short enough that Tony Hoare’s maxim of “Obviously no flaws instead of no obvious flaws” applies.)