Miscellany
public python v1 · immutableimport exceptionsclass UserError(exceptions.Exception): def __init__(self, args=None): self.args = argsdef bar(): raise UserError, "test error message"def foo(): try: u = bar() except UserError, e: print e return>>> foo()('t', 'e', 's', 't', ' ', 'e', 'r', 'r', 'o', 'r', ' ', 'm', 'e', 's', 's', 'a', 'g', 'e')