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


Groups > comp.lang.python > #4296

Re: Composition instead of inheritance

References <4DB9A096.3020200@stoneleaf.us>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2011-04-28 22:23 -0600
Subject Re: Composition instead of inheritance
Newsgroups comp.lang.python
Message-ID <mailman.983.1304051025.9059.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, Apr 28, 2011 at 11:15 AM, Ethan Furman <ethan@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!

On line 14, is it intentional that attributes whose values happen to
be false are not considered as conflicts?

On line 31, this code:

thing = getattr(thing, '__func__', None) or thing

could be simplified to this:

thing = getattr(thing, '__func__', thing)

Cheers,
Ian

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


Thread

Re: Composition instead of inheritance Ian Kelly <ian.g.kelly@gmail.com> - 2011-04-28 22:23 -0600

csiph-web