At 04:31 PM 8/9/2007, Alan Gauld wrote:
>"Dick Moores" <[EMAIL PROTECTED]> wrote
>
> > The only debugging I've done so far is to put in print statements
> > where I want to see what's happening.
>
>Thats OK for basic stuff but for complex things you can wind up
>with an awful lot of printing going on!
>
> > However, I just discovered that my excellent (IMO) Python editor,
> > Ulipad, comes with WinPdb, and I'm thinking it's about time
> > I learned how to use a debugger.
>
>Everyone should, they are wonderful tools provided you stay
>in control.
>
> > But first, could I get some reviews here of WinPdb
>
>Its very good, I think the one in eclipse/PyDev is slightly better
>but its close. Its certainly better than either IDLE or Pythonwin.
>
>The main thing in using debuggers is to avoid the temptation to
>just start the program and step all the way through. Learn to use
>a combination of break points - to target a suspect function or
>control structure and watches - the equivalent of your print
>statements. If the debugger supports conditional watches so
>much the better, then you only get output when the value
>goes to a particular condition.
>
>Once you've broken the flow at a suspect function and shown
>a known error via a watch set another break point at the next
>level up then rerun to there (conditional break points are great
>too but I don't think pdb does those...) only then do you need
>to start stepping line by line until you see the bug occur.
>
>At that point give up on the debugger and engage your brain!
>
>BTW If you can get a copy of my book (the paper one - a
>library mebbe?) there is a chapter in there about debugging
>which includes the use of raw pdb...

Thanks for all the advice and tips, Alan.

Unfortunately, I can't find your book around here. Are there any 
other books/webpages on debugging you or others can recommend?

Dick


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to