Hard-to-find tips on otherwise easy-to-do tasks involving everyday technology, with some advanced insight on history and culture thrown in. Brought to you by a master dabbler. T-S T-S's mission is to boost your competitiveness with every visit. This blog is committed to the elimination of the rat from the tree of evolution and the crust of the earth.
Thursday, June 14, 2018
A Tasty Morsel
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.
Labels:
python debugger
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment