[Tutor] Re: using debug

Alan Gauld alan.gauld at blueyonder.co.uk
Mon Aug 11 21:43:56 EDT 2003


> In IDLE there's
>
> -- file  edit  debug  windows  help --
>
> That's the debug I meant. I'm a very casual user, and it's probably
not
> for me.

Actually it probably is, but as you've discovered documents for
beginners are scarse. If its of any help my book(the paper version)
contains a chapter on debugging which has a section on using the
Python debugger pdb. Most of that applies to the IDLE debugger too.

Problem is you need a copy of my book - maybe your local library?

> I thought it might be something simple that would help debug a
program
> if I was having a problem.

Thats exactly what it does.
You can set a "Breakpoint" which forces the program to stop every time
it reaches that line. So if you set it on the first line inside a loop
the program will stop and you can examine your variable values etc.

There is a "Watch" window for making that easy...

Debuggers are wonderful tools which can become addictive. Thats
why my book recommends that you use them as a last resort after
plain print statements fail to work. Otherwise you can end up
relying on them for every little buglet. But for the hard ones
a debugger is invaluable...

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld




More information about the Tutor mailing list