How do you get a function (in Python obviously:) to behave differently when the debugger is active?
import inspect
def isDBG():
for frame in inspect.stack():
if frame[1].endswith("pdb.py"):
return True
return False
Then, just use
if isDBG() :
Confession - the title came out of a joke in "What the Rugby Jokes Did Next" (whose first page said, "You should be ashamed of yourself for picking up a book like this" :
What do a passionate kiss and a spider have in common?
They both lead to the undoing of the fly.
No comments:
Post a Comment