The l
command for pdb
is documented like so:
l
: List source code for the current file. Without arguments, list 11 lines around the current line or continue the previous listing.
I often use this command (in ipdb
as well) to see where I am, then run a few other commands to diagnose the error which will fill my terminal with other output, then want to see the code around the error again. Since a repeated l
continues previous listing, this doesn't help me.
How do I opt to not continue the previous listing upon repeated call, and instead list code around the error/current line again?
There are options to manually supply start and stop line numbers for the listing, but that is too cumbersome and messes up the flow of debugging.
ll
is often useful, but sometimes the current scope is too long, which means the error will be off screen anyways.
My current workaround is to change scope and change back using up and down commands, which is a bit clunkier than I'd want.