3 ms·
Don't forget breakpoints! Learn how to move around in the debugger, it will be a LIFESAVER. Above a troublesome line of code, drop this line: import pdb;
by ed25519FUUU 6y ago
Don't forget breakpoints! Learn how to move around in the debugger, it will be a LIFESAVER.
Above a troublesome line of code, drop this line:
import pdb; pdb.set_trace()
And run it as normally. Now you can explore. Drop into the function, step forward, go up. You just need to learn to move around. With pdb you can really explore what's going on.
- karlicoss 6y agoOr even just breakpoint() built-in in python 3.7+ In addition you can set PYTHONBREAKPOINT=ipdb.set_trace (or whatever you prefer) in your shell rc file
- wodenokoto 6y agoIt has really bothered me that `breakpoint()` didn't start ipdb when running a script using ipython. I guess this is a good workaround!