pdb.py - why is this debugger different from all other debuggers?

Andreas Kostyrka andreas at kostyrka.org
Sun Jan 15 19:44:59 EST 2006


Am Donnerstag, den 05.01.2006, 21:34 -0800 schrieb rurpy at yahoo.com:
> skip at pobox.com wrote:
> > Mike> I don't use pdb a lot either - and I write a *lot* of Python.
> >
> > Ditto.  I frequently just insert prints or enable cgitb.  Sometimes I enable
> > line tracing for a specific function and the functions it calls using a
> > tracing decorator.  There are lots of things that are easier than breaking
> > down and learning how to use pdb. ;-)
> 
> I think the degree of familiarity you and Mike have with
> Python makes using the intrinsic (for lack of a better
> word) tools easier.  For me, having a tool like pdb is a
> big help because I am not yet familiar with the all other
> options.  (For example, I never heard of cgitb until just
> now.)  I am also pretty sure both of you can draw more
> conclusions, more reliably, and from less data, then me
> so one or two added print statement for you would for
> me be 10 or 20.
> 
> pdb is light-weight enough that (I hope) it does not
Well, actually it uses the internal tracing mechanism of Python to do
the debugging so to say. As such it is nowhere even near the term
"light-weight". Actually, when it comes to execution time it's quite
heavy-weight so to say.

> obscure, or change what Python is doing -- something
> I worry about with heavier-duty debuggers.  It also
> comes with Python which gives it some kind of credibilty
> in my mind.

> For me, it is mostly useful for understanding flow of
> control and how objects change as that happens.  I
> find it easier than constantly modifying the source code.

One question that is often needed is "How did we get to this place?".
The easiest solution is, putting this code in the place you are curious
about:

import traceback ; traceback.print_stack()

Andreas


> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
URL: <http://mail.python.org/pipermail/python-list/attachments/20060116/b72d9043/attachment.sig>


More information about the Python-list mailing list