[Baypiggies] Possible future meeting topic
Fernando Perez
fperez.net at gmail.com
Wed Oct 29 18:07:51 CET 2008
On Wed, Oct 29, 2008 at 2:00 AM, Shannon -jj Behrens <jjinux at gmail.com> wrote:
> Coding in the shell is great, but sometimes coding in the debugger is
> like coding in the shell but with all the setup already taken care of
> ;) It's a good trick when you want to code in the shell, but you're
> writing a Web app that requires a full request, etc. and you need to
> "look around" at all the data in the environ to figure out what to do.
> 2 minutes looking around in pdb saves 20 minutes looking through
> middleware documentation ;)
+1. One of my favorite approaches is to simply drop an explicit
1/0
at the point in the code where I want to go rooting around. Then run
the code (I'm obviously always working in ipython :) and type %debug
after the exception blows up. This opens up a slightly nicer pdb
(with coloring and all-important tab completion), and I often find
what I need that way very quickly.
If you like this approach, for cases with more complex logic you may
find the embedded ipython trick useful:
http://ipython.scipy.org/doc/manual/html/interactive/reference.html#embedding-ipython
One line of code and you have a full-blown ipython open at any point
inside your code.
Cheers,
f
More information about the Baypiggies
mailing list