Skip to content

Latest commit

 

History

History
60 lines (56 loc) · 1.27 KB

README.md

File metadata and controls

60 lines (56 loc) · 1.27 KB

debugger

You learned that the proper way to debug a program is by printing lines, but found that it is a bit tedious process?
No worry anon, get ready to turn your spaghetti debugging code to a readable and easy to use format!

Go from this:

print("0")
// something
print("1")
// something else
print("aaaa")

to a more glorious/professional looking:

from debugger import breakpoint as b
 
# Normal breakpoint:  
b()
# Verbose breakpoint:
b(None, True)
# Passing object to print value:
x = 42
b(x)
# Verbose breakpoint with object value: 
b(x, True)

and end up with this output:

------Breakpoint------
Line:  4
----------------------
------Breakpoint------
File:  /home/x/dev/python/tester.py
Function:  <module>
Line:  7
----------------------
------Breakpoint------
Line:  11
Value:  42
----------------------
------Breakpoint------
File:  /home/x/dev/python/tester.py
Function:  <module>
Line:  14
Value:  42
----------------------

As you can see, the debugger is meticulously designed to support all the common line printing tactics.
Have fun debuggin gloriously!

Usage

After linking the library, import it to your code using:

from debugger import breakpoint as b

You can try the example by executing the provided unit test:

% python -m unittest