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

R. Bernstein rocky at panix.com
Fri Jan 6 05:34:50 CET 2006


Mike Meyer <mwm at mired.org> writes:

> rurpy at yahoo.com writes:
> Actually, you're not talking about changing the paradigm. You're
> talking about minor tweaks to the command set.

I am sorry if this was a bit of an exaggeration. Whatever.

> I don't use pdb a lot either - and I write a *lot* of Python. 

Some of us may have to *read* a lot of python. (For example I know
many people including myself who have had to deal with code written by
consultants who wrote a *lot* of code but are no longer *maintaining*
the code for various reasons). And one place debuggers tend to come in
handy is in focused or problem-solving of others' code.

> When
> something goes wrong in Python, it tells you exactly what went wrong,
> with which variable, and the file and line nubmer it went wrong at -
> along with a backtrace telling you exactly how the code got
> there. That's sufficient to track down most bugs you run into in
> practice.  

Sometimes the problem is not a bug which produces as backtrace. It
could be a misunderstanding of the intended behavior of the code.

> If not, rather than load the application into a debugger
> and futz with that, it's simpler to fire up the interpreter, import
> the module that is misbehaving, instantiate and experiment on the
> classes with bogus behavior. 

If you have a good understanding of the code that may be a good thing.
If you don't and debugging is easy (and I think someone else had
suggested python may be in some circumstances lacking here), then
debugging is desireable. I've noticed that different people pefer
different things. And that's why there's race-track betting.

> If you write code that consists of
> reasonably small methods/functions, these tools work *very* well for
> chasing down bugs. 

It would be simple-minded to assert that everyone who writes python
code works uses your tools or writes code as easy to understand as you
imply your code is.

> That my development environment lets me go from
> editing the class to testing the new code in the interpreter in a few
> keystrokes means it's *very* easy to deal with.
> 
> Given those two tools, I find I use pdb maybe once a year. I probably
> wouldn't miss it if it vanished. 

I guess you are in agreement with many POSIX shell (e.g bash, Bourne
and Korn) developers.  You see, before I wrote a debugger for bash
(http://bashdb.sourceforge.net) there just weren't any such
things. :-) And those languages are very very old maybe 20 years or
so.
 
> I'm certainly not going to spend any
> time working on it. 

Understood. I may have missed something here or wasn't clear - I
wasn't necessarily soliciting help for people to volunteer on this
although of course I would welcome any contributions. Are you the
author of pdb.py or a contributer to it?

> Of course, if you're interested in extending it
> - have fun.

Thanks!



More information about the Python-list mailing list