os.path weirdness

Peter Hansen peter at engcorp.com
Fri Jun 20 06:06:51 EDT 2003


"John J. Lee" wrote:
> 
> Jeff Layton <jeffrey.b.layton at lmco.com> writes:
> [...]
> >     Also, thanks for the comments below. I haven't used the
> > debugger at all yet. I'm an old fashioned kind of coder that
> > uses lots of "write, printf, print" to debug :) I really do
> > need to learn the debugger though.
> 
> I don't think so.  print statements are a perfectly good way of
> debugging Python code.  One of the benefits of an interpreted
> language.

"print" is fine for debugging, and I've 'ad to work with much
less (single LED hooked up to an oscilloscope, toggled in
various patterns to indicate state), but there are also times
when a few seconds with the debugger will get you farther,
faster.  One problem with the "print" approach is setup: if
it takes a long time to get to the failing code, and it might
take several runs before you get the print just right, the
pdb.set_trace() approach could mean the difference between
finding a problem in a minute and finding it in fifteen 
minutes.

Of course, I could also point out that with TDD you very
rarely have to resort to either a debugger *or* print statements,
but that's another post. ;-)

-Peter




More information about the Python-list mailing list