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

jeremito jeremit0 at gmail.com
Thu Jan 4 23:02:06 EST 2007


Gabriel Genellina wrote:
> At Thursday 4/1/2007 23:52, jeremito wrote:
>
> >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?
>
> If any subclass *must* override a method, raise NotImplementedError
> in the base class (apart from documenting how your class is supposed
> to be used).
>
>
> --
> Gabriel Genellina
> Softlab SRL
>

Thanks, that's what I needed.  Since I am a complete novice at
Exceptions, I'll have to learn about it.
Jeremy




More information about the Python-list mailing list