How to Hang Yourself With Exceptions

1 min read Original article ↗
import other
def thrower():
raise other.Exp1
def catcher():
try:
thrower()
except other.Exp1, other.Exp2:
pass
catcher()
x = other.Exp2("some message")
# Outputs:
# TypeError: 'Exp1' object is not callable
# ????????
# except other.Exp1, other.Exp2 is equivalent to
# except other.Exp2 as other.Exp2, creating an alias.
# Enjoy strange errors throughout your code :-)
# Correct:
# except (other.Exp1, other.Exp2):