You can do the folowing and just run your code normally:
class A:
def func(self):
import pdb; pdb.set_trace()
pass
Having the import and the set_trace() command on the same line allows for easy cleanup.
Navigating
A debugging prompt should appear when you run your program. Use the pdb shortcuts to step the debugger:
s(tep) : Execute the current line, stop at the first possible occasion (either in a function that is called or on the next line in the current function).
n(ext) : Continue execution until the next line in the current function is reached or it returns. (The difference between next and step is that step stops inside a called function, while next executes called functions at (nearly) full speed, only stopping at the next line in the current function.)
unt(il) : Continue execution until the line with the line number greater than the current one is reached or when returning from current frame.
r(eturn) : Continue execution until the current function returns.
c(ont(inue)) : Continue execution, only stop when a breakpoint is encountered.
Setting a breakpoint
You can do the folowing and just run your code normally:
Having the import and the set_trace() command on the same line allows for easy cleanup.
Navigating
A debugging prompt should appear when you run your program. Use the pdb shortcuts to step the debugger:
See the docs at https://docs.python.org/2/library/pdb.html