Annada Behera <annada@tilde.green> writes: > Hi, > > Recently I have been increasingly adding this piece of code as > a preamble to a lot of my code. > > import (sys, os, ipdb) > > def debug_hook(exc_type, exc_value, traceback): > if exc_type is KeyboardInterrupt: > sys.__excepthook__(exc_type, exc_value, traceback) > return > print(f"Uncaught exception: {exc_type.__name__}: {exc_value}") > ipdb.post_mortem(traceback) > > if os.environ.get('DEBUG'): sys.excepthook = debug_hook
Pretty nice contribution! I had no idea such thing was possible with Python. The more Common Lispy it gets, the better it feels! :> -- https://mail.python.org/mailman3//lists/python-list.python.org