your favorite debugging tool?

Falcolas garrickp at gmail.com
Tue Aug 25 12:11:47 EDT 2009


On Aug 23, 1:21 am, Hendrik van Rooyen <hend... at microcorp.co.za>
wrote:
> On Saturday 22 August 2009 16:49:22 Aahz wrote:
>
> > In article <mailman.227.1250951162.2854.python-l... at python.org>,
>
> > Esmail  <ebo... at hotmail.com> wrote:
> > >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.
>
> > Despite the fact that I've been using Python for more than a decade,
> > print is still my mainstay (or possibly logging to a file).
>
> Same here, although I have not been abusing python for as long as Aahz has
> been using it.
>
> ...
>
> And the final arbiter is of course the interactive prompt.
>
> - Hendrik

The only thing I would add to these comments is the fact that writing
helper functions for using print with complicated routines is very
simple, though perhaps not obvious. For example, consider the
following for unrolling list comprehensions or generators without
having to re-write them:

def trace(iterable):
    for x in iterable:
        print x
        yield x

~G



More information about the Python-list mailing list