Interfaces != Multiple Inheritance [was Re: python development practices?]

Paul Rubin phr-n2001d at nightsong.com
Tue Oct 30 21:35:48 EST 2001


Richard Jones <richard at bizarsoftware.com.au> writes:
> Java interfaces != multiple inheritance.
> 
> They address completely different issues. Mutliple inheritance allows one to 
> include functionality from multiple base classes in one step. An interface 
> indicates that your class implements a specific set of methods. Interfaces 
> don't implement functionality, therefore indicating that your class 
> implements multiple interfaces doesn't add any additional functionality.

The idea is implement an abstract base class instead of an interface.
Define methods for all the operations you want your interface to
support, and make each method simply raise NotImplementedError.  Then
make the implementation for your inheriting class supply real versions
of all the operations.



More information about the Python-list mailing list