User-defined Exceptions: is self.args OK?

petr.jakes.tpc at petr.jakes.tpc at
Wed Apr 16 12:54:27 EDT 2008

I am trying to dig through User-defined Exceptions (http:// chapter 8.5)

is it OK to add following line to the __init__ method of the
TransitionError class?
self.args = (self.previous,, self.message)

If I do not add this argument to the class, following code does not
include values from self.previous,, self.message attributes

    raise  TransitionError('previousFoo', 'nextBar', 'this is foo bar
except TransitionError,  err:
    print err
    import traceback, sys
    print sys.exc_info()

Thanks for your replies.

Petr Jakes

More information about the Python-list mailing list