4 ms·
This is only convenient in cases where (a) the breakpoint line doesn't move around a lot between different executions, as you edit the code; (b) you don't wan
by wodow 13y ago
This is only convenient in cases where
(a) the breakpoint line doesn't move around a lot between different executions, as you edit the code;
(b) you don't want to programatically invoke the debugger (i.e. if f(x): pdb.set_trace() )
- hcarvalhoalves 13y ago(a) This can be solved with an editor. Alternatively, you can use a function name instead of `filename:linenumber` to set a breakpoint. (b) Pdb supports conditions with `filename:lineno, statement`. Statement will have access to local scope. E.g.: $ python -m manage.py runserver (Pdb) break manage.py:11, os.environ["DJANGO_SETTINGS_MODULE"] == "myproj.settings" Breakpoint 1 at /Users/hcarvalhoalves/Projetos/myproj/manage.py:11 (Pdb) break Num Type Disp Enb Where 1 breakpoint keep yes at /Users/hcarvalhoalves/Projetos/myproj/manage.py:11 stop only if os.environ["DJANGO_SETTINGS_MODULE"] == "myproj.settings" Really, it does a bunch of things. I wonder why developers are unaware of it. http://docs.python.org/2/library/pdb.html http://docs.python.org/2/library/pdb.html
- wodow 13y ago(a) I'm not too sure about, but (b) I didn't realise - thanks for that.
- hcarvalhoalves 13y agoAbout (a)... there: https://github.com/hcarvalhoalves/sublime-pdburger https://github.com/hcarvalhoalves/sublime-pdburger