problem with change to exceptions

N

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 "<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.
 
P

Paul Rubin

Neal Becker said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top