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


Groups > comp.lang.python > #4293

Re: Composition instead of inheritance

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <drsalists@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.033
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'behavior.': 0.07; 'recipe': 0.07; 'python': 0.07; 'url:activestate': 0.09; 'pm,': 0.11; 'url:code': 0.11; 'wrote:': 0.14; 'furman': 0.16; 'seems': 0.21; 'header:In-Reply-To:1': 0.22; 'thu,': 0.22; 'posted': 0.22; 'java': 0.24; 'received:209.85.220': 0.26; 'instead': 0.26; 'object': 0.27; 'message-id:@mail.gmail.com': 0.28; 'class': 0.29; 'implement': 0.30; 'model': 0.31; 'carl': 0.31; 'engineering': 0.31; 'perhaps': 0.32; 'called': 0.32; 'to:addr:python-list': 0.32; 'another': 0.32; '(for': 0.33; 'using': 0.34; 'getting': 0.36; 'some': 0.37; 'it?': 0.37; 'received:209.85': 0.37; 'apr': 0.38; 'thursday,': 0.38; 'received:google.com': 0.38; 'pretty': 0.38; 'software': 0.38; 'used': 0.38; 'comments': 0.39; 'to:addr:python.org': 0.39; 'received:209': 0.39; "it's": 0.40; 'header:Received:5': 0.40; 'owns': 0.60; '2011': 0.62; 'upon': 0.63; 'concept': 0.73; 'composition': 0.84; 'rediscovered': 0.84; 'inheritance,': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=rVJMwNgo6F6iYDXfv9Rd5Ar/RwtN4mbL+M80eGeHV8o=; b=rtYVmbv3tF+W2U3BlDZIXLn6PUIK3qYw6V2CObNzTPp9jxQBHlkdRtAYDWSvox3iCi 0jUF4Il7vCp4NyBBhy1G+SGBNO5abmSI2PwGuzo9aQTlolWQBg2vWf62wSEH64bMY17T JZMZCFjSbgtDQ7zUApQJdyk5qQA4ECnj0GrHU=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=PMhUr56GBzSOXIheSAiptn9E4QN+P2zzhWonIkSPEmB8XLRtGYGyz/Cj/ITNe9sdwP 262QhaNxRq0CBohaSuVGsg2LZezGmAmsvOvzVhcTuME9+Ryh7g5pyklvazE081rXOxZG th9cVLXI9Fif8U8szUdS/BXN10Ix71k2CQqoI=
MIME-Version 1.0
In-Reply-To <d34a5410-42a1-44f6-91b4-32853ae55aca@glegroupsg2000goo.googlegroups.com>
References <mailman.946.1304010200.9059.python-list@python.org> <d34a5410-42a1-44f6-91b4-32853ae55aca@glegroupsg2000goo.googlegroups.com>
Date Thu, 28 Apr 2011 20:58:57 -0700
Subject Re: Composition instead of inheritance
From Dan Stromberg <drsalists@gmail.com>
To Python <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.981.1304049540.9059.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 82.94.164.166
X-Trace 1304049540 news.xs4all.nl 41102 [::ffff:82.94.164.166]:35125
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:4293

Show key headers only | View raw


On Thu, Apr 28, 2011 at 3:35 PM, Carl Banks <pavlovevidence@gmail.com> wrote:
> On Thursday, April 28, 2011 10:15:02 AM UTC-7, 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!
>
> That's not what we mean by composition.  Composition is when one object calls upon another object that it owns to implement some of its behavior.  Often used to model a part/whole relationship, hence the name.

It's a pretty old idea, that seems to be getting revived in a big way
all of a sudden.  Perhaps the Java people just rediscovered it?

In a Software Engineering class using Ada, the teacher called it
"Structural Inclusion", and of course it was an important concept in
Ada, because Ada had no inheritance.  This was in 1989-1990.

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


Thread

Re: Composition instead of inheritance Carl Banks <pavlovevidence@gmail.com> - 2011-04-28 15:35 -0700
  Re: Composition instead of inheritance Ethan Furman <ethan@stoneleaf.us> - 2011-04-28 18:43 -0700
    Re: Composition instead of inheritance Ben Finney <ben+python@benfinney.id.au> - 2011-04-29 13:44 +1000
      Re: Composition instead of inheritance Jean-Michel Pichavant <jeanmichel@sequans.com> - 2011-04-29 11:23 +0200
  Re: Composition instead of inheritance MRAB <python@mrabarnett.plus.com> - 2011-04-29 03:14 +0100
  Re: Composition instead of inheritance James Mills <prologic@shortcircuit.net.au> - 2011-04-29 13:16 +1000
  Re: Composition instead of inheritance Dan Stromberg <drsalists@gmail.com> - 2011-04-28 20:58 -0700
    Re: Composition instead of inheritance Ben Finney <ben+python@benfinney.id.au> - 2011-04-29 14:14 +1000
  Re: Composition instead of inheritance John Nagle <nagle@animats.com> - 2011-04-28 22:10 -0700
  Re: Composition instead of inheritance Ethan Furman <ethan@stoneleaf.us> - 2011-04-29 13:39 -0700

csiph-web