Composition instead of inheritance

Alan Meyer ameyer2 at yahoo.com
Mon May 2 13:30:02 EDT 2011


On 4/28/2011 1:15 PM, Ethan Furman 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~

That looks pretty clever.  I tried adding this method to Spam:

     def test_eggs_02(self):
         print('testing eggs_02 from spam')

and it did just what we wanted.

I'm going to have to study this one.

Thanks.

     Alan



More information about the Python-list mailing list