your favorite debugging tool?

Francesco Bochicchio bieffe62 at gmail.com
Sun Aug 23 04:12:52 EDT 2009


On Aug 22, 4:25 pm, Esmail <ebo... at hotmail.com> wrote:
> Hi all,
>
> What is your favorite tool to help you debug your
> code? I've been getting along with 'print' statements
> but that is getting old and somewhat cumbersome.
>
> I'm primarily interested in utilities for Linux (but
> if you have recommendations for Windows, I'll take
> them too :)
>
> I use emacs as my primary development environment, FWIW.
> Someone mentioned winpdb .. anyone have experience/comments
> on this? Others?
>
> Thanks,
> Esmail

Although like the others I mostly use print statements, in a few
occasions I have found useful to resort to a full-blown debugger. Of
the ones I have used, the one provided by eclipse+pydev is the one I
liked most. The one in pywin32 IDE is basic but can be useful.
With emacs, one should be able to use pydb, but I never used that,
although emacs is my most used programming environment on most
platforms.

About print cumbersomeness, I agree. As I posted elsewhere, I'd like a
'trace mechanism' with the
following characteristics:
1. Can be enabled/disabled easily, and when it is dsabled it has no
runtime costs ( i.e. disabled 'trace' statements do not generate any
code)
2. Can be enabled/disabled on a class/function/method  base (e.g.
enable only the trace in a method ), to only get the trace output from
the code you are debugging
3. Make it easy to report the context (i.e. generate messages which
starts with 'class.method:', without
  hanving to hardcode class name and method name).

I know about the 'trace' and 'logging' modules, but neither seem to
satisfy the above requirements. Probably using python introspection
and metaprogramming features it is possible to do somethinmg that
covers at least 2 and 3. Not sure about one (using if __debug__ you
can reduce the runtime cost when
compiling in optimized mode, but probably not nullify it).

Ciao
-----
FB




More information about the Python-list mailing list