protocols, inheritance and polymorphism
Steven Bethard
steven.bethard at gmail.com
Wed Nov 24 13:34:10 EST 2004
Donn Cave wrote:
> I don't have any beef with multiple inheritance, in fact the
> notion of "mix-in" classes might have some potential to be the
> basis for a more sound approach to OO.
The people that have a beef with multiple inheritance have it because
multiple inheritance can sometimes break encapsulation by forcing the
designer of a class to be aware of changes in the inheritance chain far
above its parents (even when no methods/attributes are added by the
change). A classic reference:
Snyder, Alan. "Encapsulation and Inheritance in Object-Oriented
Programming Languages"
http://www-plan.cs.colorado.edu/diwan/class-papers/snyder.pdf
Python tries to combat some of these problems with a good method
resolution order:
http://www.python.org/2.3/mro.html
I don't make enough use of multiple inheritance to ever have run into
these kinds of problems, but the literature in this area is enormous...
Steve
More information about the Python-list
mailing list