Is there a command to step out of cycles (say, for or while) while debugging on ipdb without having to use breakpoints out of them?
I use the until
command to step out of list comprehensions, but don't know how could I do a similar thing, if possible, of entire loop blocks.
Once you get you pdb prompt . Just hit n (next) 10 times to exit the loop.
If you enter pdb interactive mode there is no way to return to ipdb or ipython. The proper way to exit is by using ctrl-d .
As mentioned by Arthur in a comment, you can use r(eturn) to run execution to the end of the current function and then stop, which almost steps out of the current function. Then enter n(ext) once to complete the step out, returning to the caller.
I believe this is the intent of the until
command. It's like a next
except that when a jump occurs to a previous line number for the loop, it will continue until exiting the loop.
unt(il) Continue execution until the line with a number greater than the current one is reached or until the current frame returns
In general, to "step out" of the current function, use return
.
r(eturn) Continue execution until the current function returns.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With