Is inheritance broken?

Skip Montanaro skip at pobox.com
Wed Mar 28 23:22:21 CEST 2001


    >> How about creating mixins, then composing a set of classes from them:

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

I'm not sure what all conventions are typical that distinguish mixins from
normal classes.  I'm sure other people can answer from a lot more
experience.  Typically, mixins can't stand alone, however.  Also, there are
often multiple variants of a class of mixins.  For example, if you
implemented a networking class you might compose your concrete classes from
an abstract base class that implements the desired semantics and appropriate
mixins that know how to setup and shutdown various types of connections
(TCP, UDP, Unix sockets, etc).  Also, in some environment mixins seem to
often contain "Mixin" as a suffix of the class name so that it's clear what
their purpose is.

You might want to check recent c.l.py archives (within the last week or
three).  I seem to recall someone posting a URL about mixins.

-- 
Skip Montanaro (skip at pobox.com)
(847)971-7098




More information about the Python-list mailing list