Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > problem with change to exceptions

Reply
Thread Tools

problem with change to exceptions

 
 
Neal Becker
Guest
Posts: n/a
 
      07-27-2007
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 "<stdin>", line 1, in <module>
File "/usr/tmp/python-3143hDH", line 5, in __init__
self.args = args
TypeError: 'NoneType' object is not iterable

I'll have to say, I don't understand this error.

 
Reply With Quote
 
 
 
 
Paul Rubin
Guest
Posts: n/a
 
      07-27-2007
Neal Becker <> 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 None if no args were passed.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exceptions - How do you make it work like built-in exceptions? Lie Python 3 01-14-2008 06:45 PM
Exceptions + Performance on path without exceptions gratch06@gmail.com C++ 3 04-16-2007 08:52 PM
A Paradise DNS address change? What change? There was no change. Tony Neville NZ Computing 7 09-22-2006 01:02 PM
Checked exceptions vs unchecked exceptions Ahmed Moustafa Java 5 07-14-2004 01:46 PM
Custom exceptions -- inherit from exceptions.Exception? Paul Miller Python 3 11-12-2003 09:24 AM



Advertisments