On Thu, Jun 18, 2009 at 11:50 AM, Carlo
Hamalainen<carlo.hamalai...@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

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to