471,337 Members | 1,438 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

problem with change to exceptions

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.

Jul 27 '07 #1
1 911
Neal Becker <nd*******@gmail.comwrites:
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.
Jul 27 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by ashish | last post: by
23 posts views Thread by VB Programmer | last post: by
11 posts views Thread by stax | last post: by
4 posts views Thread by bad_boyu | last post: by
3 posts views Thread by Dmitry Prokoptsev | last post: by
5 posts views Thread by Joza | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.