[SciPy-user] mandatory overriding of class method

Ryan Krauss ryanfedora at comcast.net
Mon Jul 18 15:28:14 CDT 2005

I have a general Python question (but I am not subscribed to a general 
Python list:)-  I intend to use this for technical computing if that 
makes it any better.

I want to define a class that I don't the user to be able to use 
directly and I want to require the user to derive from the class and I 
want to require that two specifics methods be overridden for the derived 
class to be valid.  I think in C++ you could define virtual methods so 
that they had to be overridden.  Is there a way to do this in Python?  I 
thought about defining the two methods in the base class to do nothing 
but raise exceptions, but that is kind of a hack and the user would know 
there was a problem until they tried to call the methods.

Thanks for any thoughts you have,


More information about the SciPy-user mailing list