Mike Meyer <[EMAIL PROTECTED]> wrote:
> class FooException(Exception):
>       def __init__(self):
>           if self.__class__ == FooException:
>              raise NotImplementedError,
>                    "FooException is an abstract class for exceptions"

Shall try this when I get the chance. Thanks.

> Personally, I find this unpythonic. FooException doesn't contribute
> anything, and has no real reason for existing.

The purpose is to be able to specify an 'except FooException:' in some
user of that module; this allows exceptions from that particular
module to be handled differently, if necessary. (And so on for a
hierarchy of modules in a package, if that's warranted.)

-- 
 \         "A cynic is a man who knows the price of everything and the |
  `\                                value of nothing."  -- Oscar Wilde |
_o__)                                                                  |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to