[Baypiggies] Possible future meeting topic

slimmer max at theslimmers.net
Wed Oct 29 18:56:38 CET 2008

Fernando Perez 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,
> f
> _______________________________________________
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
> http://mail.python.org/mailman/listinfo/baypiggies
If your not using Ipython you can always include:
import pdb; pdb.set_trace()

this (one liner with the semi-colon) puts you in pdb.

Max Slimmer

Phone: 707.703.4396
Toll Free: 866.428.8490
email: max at SlimmerSoft.com

More information about the Baypiggies mailing list