Poll: which debugger do you use?

59 views
Skip to first unread message

Carlo Hamalainen

unread,
Jun 18, 2009, 1:50:39 PM6/18/09
to sage-...@googlegroups.com
Hi,

I'm curious about which debugging environment is most popular among
the Sage developers?

* print statements only (ugh)
* pdb
* ddd
* Eric4
* something else?

I just wrote a short post about how to get Eric4 to work with Sage
since the only instructions I could find (on some mailing list) were
out of date: http://carlo-hamalainen.net/blog/?p=53

--
Carlo Hamalainen
http://carlo-hamalainen.net

Nick Alexander

unread,
Jun 18, 2009, 2:38:01 PM6/18/09
to sage-...@googlegroups.com

On 18-Jun-09, at 10:50 AM, Carlo Hamalainen wrote:

>
> Hi,
>
> I'm curious about which debugging environment is most popular among
> the Sage developers?
>
> * print statements only (ugh)
> * pdb
> * ddd
> * Eric4
> * something else?

I use print statements and pdb (both from within emacs). I miss the
ability to set breakpoints :(

Nick

William Stein

unread,
Jun 18, 2009, 2:41:14 PM6/18/09
to sage-...@googlegroups.com

I use print statements and pdb, both from the command line. I
sometimes set breakpoints by putting "1/0" in my code. Sometimes I
use the trace command in Sage. I use gdb for Cython code. I think
%prun (the profiler) is also often useful, to see what is being
called.

My most important debugging tool is logical deduction using my brain.

-- William

Martin Albrecht

unread,
Jun 18, 2009, 3:46:34 PM6/18/09
to sage-...@googlegroups.com
> * print statements only (ugh)

I use it sometimes.

> * pdb

I use it mostly. Setting pdb.set_trace() sets a breakpoint from within the
code.

> * ddd

For some Cython stuff but mostly gdb directly.

> * Eric4

I used it a while ago: http://tinyurl.com/lxbk5h :)

> I just wrote a short post about how to get Eric4 to work with Sage
> since the only instructions I could find (on some mailing list) were
> out of date: http://carlo-hamalainen.net/blog/?p=53

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://www.informatik.uni-bremen.de/~malb
_jab: martinr...@jabber.ccc.de


William Stein

unread,
Jun 18, 2009, 3:49:36 PM6/18/09
to sage-...@googlegroups.com
On Thu, Jun 18, 2009 at 9:46 PM, Martin
Albrecht<ma...@informatik.uni-bremen.de> wrote:
>
>> * print statements only (ugh)
>
> I use it sometimes.
>
>> * pdb
>
> I use it mostly. Setting pdb.set_trace() sets a breakpoint from within the
> code.
>

If you type

sage: trace?

it has helpful documentation about pdb.set_trace(), in case you forget.

>> * ddd
>
> For some Cython stuff but mostly gdb directly.
>
>> * Eric4
>
> I used it a while ago: http://tinyurl.com/lxbk5h :)
>
>> I just wrote a short post about how to get Eric4 to work with Sage
>> since the only instructions I could find (on some mailing list) were
>> out of date: http://carlo-hamalainen.net/blog/?p=53
>
> Cheers,
> Martin
>
> --
> name: Martin Albrecht
> _pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
> _otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
> _www: http://www.informatik.uni-bremen.de/~malb
> _jab: martinr...@jabber.ccc.de
>
>
>
> >
>



--
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

Ronan Paixão

unread,
Jun 18, 2009, 7:02:23 PM6/18/09
to sage-...@googlegroups.com
Em Qui, 2009-06-18 às 20:41 +0200, William Stein escreveu:

>
> My most important debugging tool is logical deduction using my brain.
>
> -- William

Sounds very deep and witty. That's gotta become a quote on slashdot.

Ronan

Craig Citro

unread,
Jun 18, 2009, 7:05:23 PM6/18/09
to sage-...@googlegroups.com
> My most important debugging tool is logical deduction using my brain.
>

Someone want to open a trac ticket for including that in Sage? ;)

-cc

Tom Boothby

unread,
Jun 18, 2009, 7:17:16 PM6/18/09
to sage-...@googlegroups.com
print ftw!

Jason Grout

unread,
Jun 18, 2009, 9:23:39 PM6/18/09
to sage-...@googlegroups.com
Craig Citro wrote:
>> My most important debugging tool is logical deduction using my brain.
>>
>
> Someone want to open a trac ticket for including that in Sage? ;)


William's logical deductions are already progressively being included in
Sage!

John Cremona

unread,
Jun 19, 2009, 4:16:38 AM6/19/09
to sage-...@googlegroups.com
2009/6/19 Craig Citro <craig...@gmail.com>:
>
>> My most important debugging tool is logical deduction using my brain.
>>
>
> Someone want to open a trac ticket for including that in Sage? ;)

Not me -- reviewing might be fun but it would never be "closed", would it?

John

>
> -cc
>
> >
>

Robert Miller

unread,
Jun 22, 2009, 6:59:44 AM6/22/09
to sage-devel
print, think, print, think, print, think, fix

Jason Grout

unread,
Jun 22, 2009, 11:46:01 PM6/22/09
to sage-...@googlegroups.com
Robert Miller wrote:
> print, think, print, think, print, think, fix
>

Same here, except there are usually a few more print, think iterations.

Occasionally I turn to pdb as well.

At one point I also used Eclipse (not with Sage, with another python
project). That was really nice.

Jason

Ondrej Certik

unread,
Jun 23, 2009, 12:00:34 AM6/23/09
to sage-...@googlegroups.com
On Thu, Jun 18, 2009 at 11:50 AM, Carlo
Hamalainen<carlo.ha...@gmail.com> wrote:
>
> Hi,
>
> I'm curious about which debugging environment is most popular among
> the Sage developers?
>
> * print statements only (ugh)
> * pdb
> * ddd
> * Eric4
> * something else?

I use print statements, sometimes I use the following trick:

import IPython
IPython.Shell.IPShell(user_ns=dict(globals(), **locals())).mainloop()

which starts an ipython session at this place in the code, with all
the locals and globals loaded, so it's easy to experiment, what went
wrong.

Sometimes if the code is very recursive, I use a hand made debugging
printing using decorators --- I decorate each function I want to debug
and it prints a nice tree like graph, so it's easy to check things,
e.g:

SYMPY_DEBUG=True ./bin/isympy

In [1]: limit(sin(x)/x, x, 0)
limitinf(_x*sin(1/_x), _x) = 1
+-mrv_leadterm(_x*sin(1/_x), _x) = (1, 0)
| +-mrv(_x*sin(1/_x), _x) = set([_x])
| | +-mrv(_x, _x) = set([_x])
| | +-mrv(sin(1/_x), _x) = set([_x])
| | +-mrv(1/_x, _x) = set([_x])
| | +-mrv(_x, _x) = set([_x])
| +-mrv_leadterm(exp(_x)*sin(exp(-_x)), _x, set([exp(_x)])) = (1, 0)
| +-rewrite(exp(_x)*sin(exp(-_x)), set([exp(_x)]), _x, _w) =
(1/_w*sin(_w), -_x)
| +-sign(_x, _x) = 1
| +-mrv_leadterm(1, _x) = (1, 0)
+-sign(0, _x) = 0
+-limitinf(1, _x) = 1


and sometimes I need to use a real debugger, then I use winpdb.

Ondrej

Ondrej Certik

unread,
Jun 23, 2009, 12:24:42 AM6/23/09
to sage-...@googlegroups.com
On Mon, Jun 22, 2009 at 10:00 PM, Ondrej Certik<ond...@certik.cz> wrote:
> On Thu, Jun 18, 2009 at 11:50 AM, Carlo
> Hamalainen<carlo.ha...@gmail.com> wrote:
>>
>> Hi,
>>
>> I'm curious about which debugging environment is most popular among
>> the Sage developers?
>>
>> * print statements only (ugh)
>> * pdb
>> * ddd
>> * Eric4
>> * something else?
>
> I use print statements, sometimes I use the following trick:
>
> import IPython
> IPython.Shell.IPShell(user_ns=dict(globals(), **locals())).mainloop()
>
> which starts an ipython session at this place in the code, with all
> the locals and globals loaded, so it's easy to experiment, what went
> wrong.


I just sent a patch to ipython to make this easier:

http://lists.ipython.scipy.org/pipermail/ipython-dev/2009-June/005191.html

Ondrej

Dan Drake

unread,
Jun 23, 2009, 2:04:45 AM6/23/09
to sage-...@googlegroups.com
On Mon, 22 Jun 2009 at 10:00PM -0600, Ondrej Certik wrote:
> Sometimes if the code is very recursive, I use a hand made debugging
> printing using decorators --- I decorate each function I want to debug
> and it prints a nice tree like graph, so it's easy to check things,
> e.g:
>
> SYMPY_DEBUG=True ./bin/isympy
>
> In [1]: limit(sin(x)/x, x, 0)
> limitinf(_x*sin(1/_x), _x) = 1
> +-mrv_leadterm(_x*sin(1/_x), _x) = (1, 0)
> | +-mrv(_x*sin(1/_x), _x) = set([_x])
> | | +-mrv(_x, _x) = set([_x])
> | | +-mrv(sin(1/_x), _x) = set([_x])
> | | +-mrv(1/_x, _x) = set([_x])
> | | +-mrv(_x, _x) = set([_x])
> | +-mrv_leadterm(exp(_x)*sin(exp(-_x)), _x, set([exp(_x)])) = (1, 0)
> | +-rewrite(exp(_x)*sin(exp(-_x)), set([exp(_x)]), _x, _w) =
> (1/_w*sin(_w), -_x)
> | +-sign(_x, _x) = 1
> | +-mrv_leadterm(1, _x) = (1, 0)
> +-sign(0, _x) = 0
> +-limitinf(1, _x) = 1

Please share this code! I often am writing deeply recursive code and
it's so easy to get confused. I'd love to have the indentation
correspond to the call depth.

Dan

--
--- Dan Drake <dr...@kaist.edu>
----- KAIST Department of Mathematical Sciences
------- http://mathsci.kaist.ac.kr/~drake

signature.asc

Ondrej Certik

unread,
Jun 23, 2009, 2:19:27 AM6/23/09
to sage-...@googlegroups.com

$SAGE_LOCAL/lib/python2.5/site-packages/sympy/series/gruntz.py

the very first code starting after the module docstring.

Ondrej

William Stein

unread,
Jun 23, 2009, 12:39:49 PM6/23/09
to sage-...@googlegroups.com
On Mon, Jun 22, 2009 at 12:59 PM, Robert Miller<rlmil...@gmail.com> wrote:
>
> print, think, print, think, print, think, fix
>

What is your debug "printing system"? I put print "1", print "2",relevant_data

print "3", etc., and if I stick more debugging between 2 and 3, I'll
put "print 2.5", etc. What is your system and why?

William

Ondrej Certik

unread,
Jun 23, 2009, 1:11:02 PM6/23/09
to sage-...@googlegroups.com

Exactly! I use that too. But I admit, that sometimes I am just not
that clever to figure out what is going on with print statements, so I
also use other means.

O.

Reply all
Reply to author
Forward
0 new messages