Alexander Ulyanov <[email protected]> added the comment:
Perhaps it's a matter of preference. I found it convenient, since passing in a
boolean expression allows me to get rid of extra if-blocks thus reducing lines
of code and increasing debugging speed. I wanted to share my idea with the
community - but please feel free to close the issue if you find it trivial.
############## SAMPLE USE CASE ##############
import pdb
def square(i):
pdb.set_trace(trigger=not isinstance(i, (float, int)))
print(i**2)
# debug: hunting for TypeError
a = 2
square(a) # will not execute set_trace()
b = None
square(b) # will execute set_trace()
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue38054>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com