On Tue, 02 Aug 2005 08:31:27 GMT, Michael Hudson <[EMAIL PROTECTED]> wrote: >[EMAIL PROTECTED] (phil hunt) writes: > >> 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" >> >> class Concrete(Foo): >> def bar(self): >> #...actual implemtation... >> def baz(self): >> #...actual implemtation... > >Well, I guess you know this, but if Foo contains no implementation at >all, why inherit from it?
(in fact the class I'm using/creating does contain some implementation) >It would (possibly) be more Pythonic to >define an interface instead, Does Python have the concept of an interface? When was that added? -- Email: zen19725 at zen dot co dot uk -- http://mail.python.org/mailman/listinfo/python-list