Say I have code the following code:
for i in range(100):
print i
In general I can add one line to the code as:
for i in
I think you were looking for a more direct solution that did not involve adding lines to the code, and just involved debugger commands.
Your original example of
b xx, i == 10
doesn't work, because you are setting a breakpoint at the place in your code you inserted the ipdb.set_trace() command. By adding the statement 'b xx, i == 10' in the debugger, you actually have 2 break points (1 conditional and 1 unconditional) defined at the same location (assuming xx is the line were the set_trace() command is).
Alternatively, once you have defined breakpoints in your code using the 'b' command, which apparently works for you. You can add a condition to the breakpoint by
condition bpnumber boolean-expression
for example
condition 1 i == 10
Note: the bpnumber is the number assigned to the breakpoint, not the line in your code. To see a list of breakpoints, just type 'b' with no arguments.
Also, if you want to enter debug mode without using ipdb.set_trace(), you simply run your code with the pdb/ipbd module enabled
python -m pdb foo.py