#the exception instance defines __getitem__ and __str__ so the arguments can be
#accessed or printed directly without having to reference .args.
try:
raise Exception('spam', 'eggs')
except Exception, inst:
print type(inst) # the exception instance
print inst.args # arguments stored in .args
print inst # __str__ allows args to printed directly
x, y = inst # __getitem__ allows args to be unpacked directly
print 'x =', x
print 'y =', y