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


Groups > comp.lang.python > #4487

Re: Composition instead of inheritance

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From Alan Meyer <ameyer2@yahoo.com>
Newsgroups comp.lang.python
Subject Re: Composition instead of inheritance
Date Mon, 02 May 2011 13:30:02 -0400
Organization A noiseless patient Spider
Lines 23
Message-ID <4DBEEA1A.6000004@yahoo.com> (permalink)
References <mailman.946.1304010200.9059.python-list@python.org>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Injection-Info mx02.eternal-september.org; posting-host="cXfoUdE2tOmL54C/tFXK/Q"; logging-data="18055"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Nm9LtqBRB9joWQOSFTL2i"
User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10
In-Reply-To <mailman.946.1304010200.9059.python-list@python.org>
Cancel-Lock sha1:YEGBVaLjwsoow9Wz4UBAEFkAD0E=
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:4487

Show key headers only | 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