Re: Weird exception in my, um, exception class constructor

2008-05-28 Thread Arnaud Delobelle
Joel Koltner [EMAIL PROTECTED] writes: Paul Hankin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Did you actually write self,args = args? (looks at source code) [EMAIL PROTECTED] Why, yes, yes I did! Thanks for catching that... This is odd, because you should get this error

Weird exception in my, um, exception class constructor

2008-05-27 Thread Joel Koltner
I have a generic (do nothing) exception class that's coded like this: class MyError(exceptions.Exception): def __init__(self,args=None): self.args = args When I attempt to raise this exception via 'raise MyError' I get an exception within the MyError constructor __init__ as follows:

Re: Weird exception in my, um, exception class constructor

2008-05-27 Thread Arnaud Delobelle
Joel Koltner [EMAIL PROTECTED] writes: I have a generic (do nothing) exception class that's coded like this: class MyError(exceptions.Exception): def __init__(self,args=None): self.args = args When I attempt to raise this exception via 'raise MyError' I get an exception within

Re: Weird exception in my, um, exception class constructor

2008-05-27 Thread Paul Hankin
On May 27, 9:21 pm, Joel Koltner [EMAIL PROTECTED] wrote: I have a generic (do nothing) exception class that's coded like this: class MyError(exceptions.Exception):     def __init__(self,args=None):         self.args = args When I attempt to raise this exception via 'raise MyError' I get an

Re: Weird exception in my, um, exception class constructor

2008-05-27 Thread Joel Koltner
Hi Arnaud, Arnaud Delobelle [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] That's because the class 'Exception' defines a descriptor 'args' which has to be a sequence. Ah, thanks. I was following the example in Beazley's book and should have dug into the actual documentation a

Re: Weird exception in my, um, exception class constructor

2008-05-27 Thread Joel Koltner
Paul Hankin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Did you actually write self,args = args? (looks at source code) [EMAIL PROTECTED] Why, yes, yes I did! Thanks for catching that... -- http://mail.python.org/mailman/listinfo/python-list

Re: Weird exception in my, um, exception class constructor

2008-05-27 Thread Terry Reedy
Joel Koltner [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | Sounds good to me. I take it that, if I don't inherit from Exception, various | expected behaviors will break? (This is what Beazley suggests...) All builtin exceptions have been in the builtin namespace for a while.