[Baypiggies] Possible future meeting topic

Shannon -jj Behrens jjinux at gmail.com
Sat Nov 1 10:26:19 CET 2008


On Wed, Oct 29, 2008 at 10:07 AM, Fernando Perez <fperez.net at gmail.com> wrote:
> 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,

I think you should cover this at the talk ;)

I use "import pdb; pdb.set_trace()", but since I already use IPython,
I'd love to hear more about %debug.

-jj

-- 
The safest way to do multithreaded programming is to put each thread
in its own process ;)
http://jjinux.blogspot.com/


More information about the Baypiggies mailing list