[Python-3000] removing exception .args (original) (raw)

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Jul 22 02:26:24 CEST 2007


Georg Brandl wrote:

Hm, I always found it useful to just do

class MyCustomError(Exception): pass and give it arbitrary arguments to it without writing init method stuff that I can access from outside.

Maybe

class Exception(object):

 def __init__(self, msg = None, **kwds):
   self.msg = msg
   self.__dict__.update(kwds)

Then you'd have to pass your extra args as keyword args, but you could still avoid having an init if you wanted.

-- Greg



More information about the Python-3000 mailing list