Re: Abstract Base Classes

2005-11-13 Thread Steven D'Aprano
Ben Finney wrote: > Ben Finney <[EMAIL PROTECTED]> wrote: > >>I want my modules to (sometimes) define an abstract base exception >>class, that all other exceptions in that module inherit from. > > > [re-posting with the implementation properly foo-ified] Isn't the proper Python idiom to use Mon

Re: Abstract Base Classes

2005-11-13 Thread Ben Finney
Ben Finney <[EMAIL PROTECTED]> wrote: > I want my modules to (sometimes) define an abstract base exception > class, that all other exceptions in that module inherit from. [re-posting with the implementation properly foo-ified] Not a whole lot of feedback on this, so here's the implementation I de

Re: Abstract Base Classes

2005-11-13 Thread Ben Finney
Ben Finney <[EMAIL PROTECTED]> wrote: > I want my modules to (sometimes) define an abstract base exception > class, that all other exceptions in that module inherit from. Not a whole lot of feedback on this, so here's the implementation I decided upon. class FooException(Exception): "

Re: Abstract Base Classes

2005-11-11 Thread Colin J. Williams
Ben Finney wrote: > Howdy all, > > Okay, so Guido doesn't like Abstract Base Classes[0], and interfaces > are the way of the future[1]. But they're not here now, and I > understand ABCs better. This is a very interesting discussion - not all of it understandable to me. Are interfaces really in ou

Re: Abstract Base Classes

2005-11-10 Thread Ben Finney
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.

Re: Abstract Base Classes

2005-11-10 Thread Mike Meyer
Ben Finney <[EMAIL PROTECTED]> writes: > I've tried doing this in the __init__(): > > class FooException(Exception): > """ Base class for all FooModule exceptions """ > def __init__(self): > raise NotImplementedError, \ > "%s is an abstract class for