P
phil hunt
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...
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...