Is inheritance broken?

Johann Hibschman johann at
Thu Mar 29 00:13:08 CEST 2001

Jonathan Claggett writes:

> Interesting. Are there conventions for mixin classes which distinguish them
> from normal classes? For example, are mixins not suppposed to use
> inheritance (or at least not use mulitple inheritance)? Thanks for the help,

When I use mixins, I never use inheritance.  The mix-in just provides
methods, to be included into other classes.  There is no enforced
protocol, but I find that useful.

Otherwise, I have to start worrying about how python will search the mix-
ins, and that gets ugly quickly.

I also often define classes which are simply different combinations
of mix-ins, such as

class SpecPlotStepper(SpecMixin, PlotMixin, Stepper):

I hope that helps.  In theory, I like the way Common Lisp implemented
multiple inheritance, but that would require too much searching given
python's class system.


Johann Hibschman                           johann at

More information about the Python-list mailing list