"Michele Simionato" <[EMAIL PROTECTED]> writes: > adding methods on the fly and metaclasses could live pretty well > without > multiple inheritance. There would be no real loss > of power and hopefully less monstruosities such > a Zope 2. But maybe this is just wishful thinking ...
Um, no real loss of power? Well, in the sense that all languages are turing-equivalent, maybe. My current project includes a small set of classes that all deal with web pages. The classes exist in three layers: the first layer is very abstract, and provides a general mechanism. The second layer adapts the general mechanasm to a specific case. The last layer provides application-specific functionality. The classes intercommunicate, but are generally completely unrelated to each other except for the more concrete classes inheriting from the layer above. So far, so good - it's all simple single inheritance. Now, I have a class Utility that collects utility methods that are useful for dealing with web pages: extracting data, filling out forms, etc. These are provided as a mixin. The classes that need this functionality inherits from it as well as their parent. The classes that don't need it don't. This makes use of multiple inheritance. Without multiple inheritance, I would have had to make the Utility class a parent of all the most abstract classes. Some of the those classes don't need that functionality - but their children do, so they have to inherit from it. Children's needs shouldn't influence the implementation of the child - that's simply ugly. Also, it creates an apparent relationship between all the most abstract classes that doesn't really exist. Do you have a proposed solution that doesn't have these problems? <mike -- Mike Meyer <[EMAIL PROTECTED]> http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. -- http://mail.python.org/mailman/listinfo/python-list