Debugging in Python

Miss being able to inspect, debug and run expressions in between your code?

I’ve heard so much about iPython’s debugging functionality and it turns out there’s a way to make use of it without having to use iPython itself.

Meet ipdb.

With just a couple of simple steps:

import ipdb

print("before break")
ipdb.set_trace()
print("after break")

You’ll drop into a nice interactive shell for your debugging need.

Most syntaxes are similar to ruby-debug, so if you’re coming from ruby, you shouldn’t have any issue.

ipdb screenshot

Enjoy!