Say I have the following code:
try:
print 'foo'
# A lot more code...
print 'bar'
except:
pass
How would I for testing purposes disable the try-statement temporary?
You can’t just comment the try and except lines out as the indention will still be off.
Isn’t there any easier way than this?
#try: print 'foo' # A lot more code... print 'bar' #except: # pass
You could reraise the exception as the first line of your except block, which would behave just as it would without the try/except.