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
>
> 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
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
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
>
> 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
Someone want to open a trac ticket for including that in Sage? ;)
-cc
William's logical deductions are already progressively being included in
Sage!
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
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
I just sent a patch to ipython to make this easier:
http://lists.ipython.scipy.org/pipermail/ipython-dev/2009-June/005191.html
Ondrej
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
$SAGE_LOCAL/lib/python2.5/site-packages/sympy/series/gruntz.py
the very first code starting after the module docstring.
Ondrej
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
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.