[IPython-user] python vs. ipython
Fernando Perez
Fernando.Perez at colorado.edu
Fri Jan 27 11:39:44 CST 2006
Ville Vainio wrote:
> Note that SVN may be in a bad-ish state right now, I accidentally made
> a checkin (I though I'd do bzr ci, but accidentally did svn ci.
> Suck.). It should work, but there may be some humps like debug prints
> (but sys.argv thing is such a thing too).
No prob. Just a note on debugging conventions for the code (I should write
this up on the wiki at some point): it would be nice if we could all stick to
what I've been using so far, which is either:
print 'something:',blah # dbg
or using
debugx('expr_to_evaluate')
The second form is found in genutils (imported by most things), and it will
actually evaluate anything you feed it in your own frame (by walking back up
the stack). I've stuck to these (well, the 2nd form is a newer addition),
because then I can go into the IPython/ dir and simply issue
fdbg
which is an alias for
planck[mjmdim]> which fdbg
fdbg: aliased to egrep -n 'dbg|debugx\(' *py | egrep -v 'def
debugx|\:[[:space:]]*\#'
(one line) and it instantly prints out any such calls which are still active.
Following this simple convention allows for an easy way to track unused
debug statements before any commit/release. You can even temporarily disable
the debugx() ones by redefining debugx to be a no-op, but such calls shouldn't
be left in committed/released code, since the function call price still would
be paid.
Part of my commit routine is to do
1. fdbg
2. comment out any lines with remaining active calls
If we all follow the same convention, we'll reduce the chances of accidentally
leftover debug code (and we'll more easily catch each other's slips when they
happen).
Cheers,
f
More information about the IPython-user
mailing list