Skip to content

Instantly share code, notes, and snippets.

@Mic92
Created February 14, 2012 22: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 Mic92/1830940 to your computer and use it in GitHub Desktop.
Save Mic92/1830940 to your computer and use it in GitHub Desktop.
Weird named Exception
#!/usr/bin/env python
err = "Foobar"
try:
print("Still the same %s" % err)
1/0
except ZeroDivisionError as err:
print("Got error: %s" % err)
try:
print("In python 2 err is overwritten %s " % err)
except NameError:
print("In python 3, it throws an exception")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment