Tom Anderson wrote:

>> class NeverRaised(Exception):
>>    def __init__(self, *args):
>>        raise RuntimeError('NeverRaised should never be raised')
> 
> Briliant! Although i'd be tempted to define an
> UnraisableExceptionError to signal what's happened. Or ...
> 
> class ImpossibleException(Exception):
>       def __init__(self, *args):
>            raise ImpossibleException, args
> 
> Although crashing the interpreter is probably overkill.

Crashng the interpreter would be, but what you just wrote is simply a more 
obscure way of raising RuntimeError :-)

>>> class ImpossibleException(Exception):
...     def __init__(self, *args):
...             raise ImpossibleException, args
...
>>> raise ImpossibleException
Traceback (most recent call last):
  File "<stdin>", line 3, in __init__
RuntimeError: maximum recursion depth exceeded
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to