Is this Pythonic?

phil hunt zen19725 at zen.co.uk
Mon Aug 1 12:05:09 EDT 2005


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...




-- 
Email: zen19725 at zen dot co dot uk





More information about the Python-list mailing list