Re: Composition instead of inheritance

2011-05-02 Thread Alan Meyer
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

Re: Composition instead of inheritance

2011-04-29 Thread Jean-Michel Pichavant
Ben Finney wrote: Ethan Furman et...@stoneleaf.us writes: Carl Banks wrote: 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.

Re: Composition instead of inheritance

2011-04-29 Thread Ethan Furman
James Mills wrote: On Fri, Apr 29, 2011 at 11:43 AM, Ethan Furman et...@stoneleaf.us wrote: Hmmm. Okay -- any ideas for a better term? Something that describes taking different source classes and fusing them into a new whole, possibly using single-inheritance... Frankenstein, maybe? ;) I'd

Re: Composition instead of inheritance

2011-04-29 Thread Carl Banks
On Thursday, April 28, 2011 6:43:35 PM UTC-7, Ethan Furman wrote: Carl Banks wrote: The sorts of class that this decorator will work for are probably not the ones that are going to have problems cooperating in the first place. So you might as well just use inheritance; that way people

Re: Composition instead of inheritance

2011-04-29 Thread Ethan Furman
Carl Banks wrote: Here is my advice on mixins: [snip] Cool. Thanks! ~Ethan -- http://mail.python.org/mailman/listinfo/python-list

Re: Composition instead of inheritance

2011-04-29 Thread Ian Kelly
On Fri, Apr 29, 2011 at 3:09 PM, Carl Banks pavlovevide...@gmail.com wrote: Here is my advice on mixins: Mixins should almost always be listed first in the bases.  (The only exception is to work around a technicality.  Otherwise mixins go first.) If a mixin defines __init__, it should

Re: Composition instead of inheritance

2011-04-29 Thread Ethan Furman
Ian Kelly wrote: On Thu, Apr 28, 2011 at 11:15 AM, Ethan Furman et...@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

Re: Composition instead of inheritance

2011-04-29 Thread Carl Banks
On Friday, April 29, 2011 2:44:56 PM UTC-7, Ian wrote: On Fri, Apr 29, 2011 at 3:09 PM, Carl Banks wrote: Here is my advice on mixins: Mixins should almost always be listed first in the bases.  (The only exception is to work around a technicality.  Otherwise mixins go first.) If a

Re: Composition instead of inheritance

2011-04-29 Thread Ian Kelly
On Fri, Apr 29, 2011 at 5:54 PM, Carl Banks pavlovevide...@gmail.com wrote: Really, *any* class that uses super().__init__ should take its arguments and pass them along in this manner. If you are programming defensively for any possible scenario, you might try this (and you'd still fail).

Composition instead of inheritance

2011-04-28 Thread Ethan Furman
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~ -- http://mail.python.org

Re: Composition instead of inheritance

2011-04-28 Thread Eric Snow
On Thu, Apr 28, 2011 at 11:15 AM, Ethan Furman et...@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

Re: Composition instead of inheritance

2011-04-28 Thread Jean-Michel Pichavant
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~ Sounds

Re: Composition instead of inheritance

2011-04-28 Thread Ben Finney
Ethan Furman et...@stoneleaf.us writes: 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

Re: Composition instead of inheritance

2011-04-28 Thread Carl Banks
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

Re: Composition instead of inheritance

2011-04-28 Thread Ethan Furman
Carl Banks wrote: 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. Hmmm. Okay -- any ideas for a better term? Something that

Re: Composition instead of inheritance

2011-04-28 Thread MRAB
On 29/04/2011 02:43, Ethan Furman wrote: Carl Banks wrote: 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. Hmmm. Okay -- any

Re: Composition instead of inheritance

2011-04-28 Thread Steven D'Aprano
On Thu, 28 Apr 2011 15:35:47 -0700, Carl Banks 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

Re: Composition instead of inheritance

2011-04-28 Thread James Mills
On Fri, Apr 29, 2011 at 11:43 AM, Ethan Furman et...@stoneleaf.us wrote: Hmmm. Okay -- any ideas for a better term?  Something that describes taking different source classes and fusing them into a new whole, possibly using single-inheritance... Frankenstein, maybe?  ;) I'd have to say that

Re: Composition instead of inheritance

2011-04-28 Thread Ben Finney
Ethan Furman et...@stoneleaf.us writes: Carl Banks wrote: 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. Hmmm. Okay -- any

Re: Composition instead of inheritance

2011-04-28 Thread Ben Finney
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes: On Thu, 28 Apr 2011 15:35:47 -0700, Carl Banks wrote: 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. I thought that was

Re: Composition instead of inheritance

2011-04-28 Thread Dan Stromberg
On Thu, Apr 28, 2011 at 3:35 PM, Carl Banks pavlovevide...@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

Re: Composition instead of inheritance

2011-04-28 Thread Ben Finney
Dan Stromberg drsali...@gmail.com writes: On Thu, Apr 28, 2011 at 3:35 PM, Carl Banks pavlovevide...@gmail.com wrote: 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

Re: Composition instead of inheritance

2011-04-28 Thread Ian Kelly
On Thu, Apr 28, 2011 at 11:15 AM, Ethan Furman et...@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

Re: Composition instead of inheritance

2011-04-28 Thread John Nagle
On 4/28/2011 3:35 PM, Carl Banks 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