Skip to content

Instantly share code, notes, and snippets.

@EdwardIII
Created January 21, 2014 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EdwardIII/6a9811109e4b21a5d389 to your computer and use it in GitHub Desktop.
Save EdwardIII/6a9811109e4b21a5d389 to your computer and use it in GitHub Desktop.
def terrible_function(divide=False):
if divide:
raise ZeroDivisionError
d = {}
print d['not_a_real_key']
return "Great!"
try:
terrible_function()
except (KeyError, ZeroDivisionError) as e:
print type(e)
try:
terrible_function(True)
except (KeyError, ZeroDivisionError) as e:
print type(e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment