On Sep 20, 5:41 am, Ben Finney <[EMAIL PROTECTED]> wrote: > Michele Simionato <[EMAIL PROTECTED]> writes: > > Ben Finney wrote: > > > What do you see as an appropriate use of mixin classes, and what > > > an abuse? > > > An example of fine usage of mixin is Tkinter; an example of bad > > usage if Zope 2. > > Which parts of those two very large code sets do I need to look at to > see the examples you have in mind? I was hoping you could demonstrate > with short code examples.
Unfortunately you see the issue only when you program in the large. Take for instance the Plone BaseContent class; I believe its MRO contains something like 35 classes (I don't remember the exact number now) in a multiple inheritance hierarchy. Instances have some something like 400+ methods and attributes. Now try to understand from which of the parent classes the attributes came. For Tkinter things are much easier, see the effbot "Introduction to Tkinter" for a discussion of the mixin classes it uses. Then try something like inspect.getmro(Tkinter.Label) , there are only 7 classes in the hierarchy. Notice that even with single inheritance you can run in deep hierarchies (Java docet).The problem, as Guido once said, is the "inheritance is overrated". Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list