Re: problem with change to exceptions

2007-07-29 Thread Gabriel Genellina
En Fri, 27 Jul 2007 19:49:17 -0300, Neal Becker <[EMAIL PROTECTED]> escribió: > import exceptions > > class nothing (exceptions.Exception): > def __init__ (self, args=None): > self.args = args > > if __name__ == "__main__": > raise nothing > > Traceback (most recent call last): >

Re: problem with change to exceptions

2007-07-27 Thread Alex Popescu
Neal Becker <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > Alex Popescu wrote: > >> Neal Becker <[EMAIL PROTECTED]> wrote in >> news:[EMAIL PROTECTED]: >> > > [snip...] > >>> >> >> You can pass to the exception: >> a) a string (it will become the message) >> b) a tuple of values (can

Re: problem with change to exceptions

2007-07-27 Thread Paul Rubin
Neal Becker <[EMAIL PROTECTED]> writes: > should set self.args to None. Nothing wrong there, and what has this got to > do with NoneType being iterable? Probably the traceback constructor tried to iterate through the args. You should initialize the args to an empty tuple, not None. Also note th

Re: problem with change to exceptions

2007-07-27 Thread Neal Becker
Alex Popescu wrote: > Neal Becker <[EMAIL PROTECTED]> wrote in > news:[EMAIL PROTECTED]: > >> import exceptions >> >> class nothing (exceptions.Exception): >> def __init__ (self, args=None): >> self.args = args >> >> if __name__ == "__main__": >> raise nothing >> >> Traceback (

Re: problem with change to exceptions

2007-07-27 Thread Alex Popescu
Neal Becker <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > import exceptions > > class nothing (exceptions.Exception): > def __init__ (self, args=None): > self.args = args > > if __name__ == "__main__": > raise nothing > > Traceback (most recent call last): > File "",

Re: problem with change to exceptions

2007-07-27 Thread Paul Rubin
Neal Becker <[EMAIL PROTECTED]> writes: > TypeError: 'NoneType' object is not iterable > I'll have to say, I don't understand this error. It's "lame duck typing". The .args attribute on an Exception instance is expected to be a tuple of the arguments passed through the raise statement. It is Non

problem with change to exceptions

2007-07-27 Thread Neal Becker
import exceptions class nothing (exceptions.Exception): def __init__ (self, args=None): self.args = args if __name__ == "__main__": raise nothing Traceback (most recent call last): File "", line 1, in File "/usr/tmp/python-3143hDH", line 5, in __init__ self.args = args T