On Mon, 01 Aug 2005 12:52:02 -0400, Peter Hansen <[EMAIL PROTECTED]> wrote: >phil hunt wrote: >> Suppose I'm writing an abstract superclass which will have some >> concrete subclasses. I want to signal in my code that the subclasses >> will implement certan methods. Is this a Pythonic way of doing what >> I have in mind: >> >> class Foo: # abstract superclass >> def bar(self): >> raise Exception, "Implemented by subclass" >> def baz(self): >> raise Exception, "Implemented by subclass" > >Change those to "raise NotImplementedError('blah')" instead and you'll >be taking the more idiomatic approach.
Ta -- Email: zen19725 at zen dot co dot uk -- http://mail.python.org/mailman/listinfo/python-list