I am a Perl programmer learning Python. I am writing my code in debugging emacs using python -m pdb script.pywith Python 2.7.3.
I would like to know what is equivalent to python in Perl, adding python $DB::single=1;1;to a specific line of code, so when you start the debugger it will stop there, even if it is a different source code from where the file starts (for example, the code line in the library is used script.py).
Any ideas?
EDITED: after watching pdb.set_trace()or ipdb.set_trace(), I think they are good solutions, but not 100% identical to the behavior $DB::single=1;1;. This, I would like the breakpoint to be on the set_trace line, and not on the next line. This is done in Perl $DB::single=1;by adding another statement on the same line: 1;what makes it $DB::single=1;1;.
Using set_trace(), I get a breakpoint in the line after the statement, even if I add it after it 1;. Still not fully understanding how Python treats strings with multiple statements compared to Perl.
Is anyone

Any ideas?
source
share