Composition instead of inheritance

Eric Snow ericsnowcurrently at gmail.com
Thu Apr 28 13:55:23 EDT 2011


On Thu, Apr 28, 2011 at 11:15 AM, Ethan Furman <ethan at stoneleaf.us> wrote:

> For anybody interested in composition instead of multiple inheritance, I
> have posted this recipe on ActiveState (for python 2.6/7, not 3.x):
>
>
> http://code.activestate.com/recipes/577658-composition-of-classes-instead-of-multiple-inherit/
>
> Comments welcome!
>
> ~Ethan~
> --
> http://mail.python.org/mailman/listinfo/python-list
>

That's cool.  And if Spam and Eggs were abstract base classes you could
register TestAll to them.  Granted, that is not so applicable in your
example.   But generally that would help bridge the inheritance gap for
isinstance cases.

-eric

p.s. I would have commented on the recipe but could not log in...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110428/9f37c4af/attachment.html>


More information about the Python-list mailing list