We can install ipdb (interactive python debugger) via pip
For example,
$ pip install ipdbTo insert a breakpoint (hard coded break points) in the code use ipdb.set_trace(). You can insert many breakpoints as you like. To run the code:
$ python mycode.pyWhen the breakpoint is hit, you will be dropped to ipdb prompt, similar to the ipython prompt. Use "c" (continue) command to continue the code until the next breakpoint or until the program ends.
For example,
import sparsesvd import ipdb def f(x): print x y = 2 *x ipdb.set_trace() print y z = y * 3 ipdb.set_trace() print z pass if __name__ == "__main__": f(10) print "all done"