kj <no.em...@please.post> wrote:
>
>Suppose that I want to write a subclass C of base classes A and B.
>What considerations should go into choosing the ordering of A and
>B in C's base class list?
>...
>...it is difficult for me to see a strong compelling reason for picking
>an ordering over another.  But may be just ignorance on my part.
>
>How should one go about deciding the ordering of base classes?

In general, it is uncommon to have a class that derives from multiple
classes that all provide major functionality.  That quickly gets confusing,
which is one reason Java doesn't allow multiple inheritance.

Now, it is very common for a class to derive from one class primarily, with
other classes providing a few additional features.  That's the "mix-in"
concept.  In that case, you'd list the "major" ancestor first, with the
mix-ins after, so the mix-ins can modify the behavior.

  class BlueSpanishListBox( ListBox, ColorBlueMixIn, SpanishMixIn ):
     ...

Reading it, a BlueSpanishListBox is-a ListBox that happens to have a few
additional features.
-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to