Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #4487

Re: Composition instead of inheritance

From Alan Meyer <ameyer2@yahoo.com>
Newsgroups comp.lang.python
Subject Re: Composition instead of inheritance
Date 2011-05-02 13:30 -0400
Organization A noiseless patient Spider
Message-ID <4DBEEA1A.6000004@yahoo.com> (permalink)
References <mailman.946.1304010200.9059.python-list@python.org>

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Composition instead of inheritance Ethan Furman <ethan@stoneleaf.us> - 2011-04-28 10:15 -0700
  Re: Composition instead of inheritance Ben Finney <ben+python@benfinney.id.au> - 2011-04-29 07:38 +1000
  Re: Composition instead of inheritance Alan Meyer <ameyer2@yahoo.com> - 2011-05-02 13:30 -0400

csiph-web