NOTE- this comes from Jon Smajda @smajda, who presented at PythonKC
My one cool Python trick from today:
When you're debugging some code, if you put this at the line you want to look at:
import pdb; pdb.set_trace()
You will be dropped into an interactive shell at that point in your code. For example:
> /Users/jon/Dropbox/docs/programming/python/talks/logging/people/validate_people.py(34)<module>()
-> stream_handler.setLevel(loglevel)
(Pdb) loglevel
40
If you pip install ipdb
you can use this instead:
import ipdb; ipdb.set_trace()
And use the IPython debugger instead of the built-in Pdb.