What is proper way to require a method to be overridden?

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Fri Jan 5 14:26:07 CET 2007

jeremito a écrit :
> I am writing a class that is intended to be subclassed.  What is the
> proper way to indicate that a sub class must override a method?

class Base(object):
   def method_to_override(self, *args, **kw):
     raise NotImplementedError("You need to override this method")

More information about the Python-list mailing list