Debugging technique

Frank Millman frank at chagford.com
Sat Oct 3 03:08:24 EDT 2020


On 2020-10-03 8:58 AM, Chris Angelico wrote:
> On Sat, Oct 3, 2020 at 4:53 PM Frank Millman <frank at chagford.com> wrote:
>>
>> Hi all
>>
>> When debugging, I sometimes add a 'breakpoint()' to my code to examine
>> various objects.
>>
>> However, I often want to know how I got there, so I replace the
>> 'breakpoint()' with a '1/0', to force a traceback at that point. Then I
>> can rerun the previous step using the extra info from the traceback.
>>
>> Is there a way to combine these into one step, so that, while in the
>> debugger, I can find out how I got there?
>>
> 
> Not sure if it's what you're looking for, but in the debugger, you can
> type "bt" to show a backtrace.
> 

That is exactly what I was looking for :-)

Thanks very much.

Frank



More information about the Python-list mailing list