On Mon, 01 Aug 2005 14:07:46 -0700, Erik Max Francis <[EMAIL PROTECTED]> wrote: > >Yes, but raise NotImplementedError instead of Exception. Another trick >you can use is to prevent people from instantiating the abstract class: > > class Foo: > def __init__(self): > if self.__class__ is Foo: > raise NotImplementedError > ... > > def bar(self): > raise NotImplementedError
That's a clever trick, but it's obvious from the code that the class is intended to be abstract, so if people are stupid enough to shoot themselves in the foot by creating an instance, I don't feel like adding extra code to protect themselves from their stupidity. -- Email: zen19725 at zen dot co dot uk -- http://mail.python.org/mailman/listinfo/python-list