Weird exception in my, um, exception class constructor

Arnaud Delobelle arnodel at googlemail.com
Wed May 28 02:43:30 EDT 2008


"Joel Koltner" <zapwireDASHgroups at yahoo.com> writes:

> "Paul Hankin" <paul.hankin at gmail.com> wrote in message 
> news:0ea08237-c9f9-441b-a744-7410114b5ae9 at t54g2000hsg.googlegroups.com...
> "Did you actually write self,args = args?"
>
> (looks at source code)
>
> $#@#%#$  Why, yes, yes I did!  Thanks for catching that...

This is odd, because you should get this error even if writing
self.args=args, witness this copy-paste from the interactive prompt:

>>> class MyError(Exception):
...     def __init__(self, args=None):
...         self.args = args
... 
>>> MyError()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 3, in __init__
TypeError: 'NoneType' object is not iterable

-- 
Arnaud



More information about the Python-list mailing list