I have some code that handles an exception, and I want to do something specific only if it's a specific exception, and only in debug mode. So for example:
try:
stuff()
except Exception as e:
if _debug and e is KeyboardInterrupt:
sys.exit()
logging.exception("Normal handling")
As such, I don't want to just add a:
except KeyboardInterrupt:
sys.exit()
because I'm trying to keep the difference in this debug code minimal