debug_print_statements - Python print statements to aid debugging
Friday, December 22nd, 2006When one is programming, the humble print statement is used frequently for debugging purposes. I’ve written a python module debug_print_statements that provides some simple functions to print helpful information. It uses some pretty cool introspective python stuff.
Download the latest version here (v0.1)
print_line_number()
Calling this function will print the file and line number of where that function is in the file. It will figure out by itself what the line number is. Printing the line number is helpful to see if a piece of code gets executed, but as you add or remove lines from a file, this number can change, which makes it hard to go back to that place in the file.
print_local_variables()
When you call this, all the local variables will be printed (along with their names)