Re: Mixin classes and single/multiple inheritance

2007-09-20 Thread Steven D'Aprano
On Thu, 20 Sep 2007 14:52:50 +1000, Ben Finney wrote: > Can you give a code example of how you think mixins should be > implemented in Python, assuming the absence of multiple inheritance? I'll take a shot at it... use automatic delegation to the mixin class. class Parrot(object): def fl

Re: Mixin classes and single/multiple inheritance

2007-09-19 Thread thebjorn
On Sep 20, 6:52 am, Ben Finney <[EMAIL PROTECTED]> wrote: > Michele Simionato <[EMAIL PROTECTED]> writes: > > Since the language we have does have multiple inheritance, let's > > use it to implement mixins. > > ... > > So, multiple inheritance is giving us very little for the point of > > view of m

Re: Mixin classes and single/multiple inheritance

2007-09-19 Thread Michele Simionato
On Sep 20, 6:52 am, Ben Finney <[EMAIL PROTECTED]> wrote: > Michele Simionato <[EMAIL PROTECTED]> writes: > > Since the language we have does have multiple inheritance, let's > > use it to implement mixins. > > ... > > So, multiple inheritance is giving us very little for the point of > > view of m

Re: Mixin classes and single/multiple inheritance

2007-09-19 Thread Ben Finney
Michele Simionato <[EMAIL PROTECTED]> writes: > Since the language we have does have multiple inheritance, let's > use it to implement mixins. > ... > So, multiple inheritance is giving us very little for the point of > view of mixins; OTOH, multiple inheritance is giving us a lot of > headaches f

Re: Mixin classes and single/multiple inheritance

2007-09-19 Thread Michele Simionato
On Sep 20, 5:41 am, Ben Finney <[EMAIL PROTECTED]> wrote: > Michele Simionato <[EMAIL PROTECTED]> writes: > > Ben Finney wrote: > > > What do you see as an appropriate use of mixin classes, and what > > > an abuse? > > > An example of fine usage of mixin is Tkinter; an example of bad > > usage if Z

Re: Mixin classes and single/multiple inheritance

2007-09-19 Thread Michele Simionato
On Sep 20, 5:41 am, Ben Finney <[EMAIL PROTECTED]> wrote: > Okay. How do we use the language we have to achieve what mixin classes > achieve in Ruby? Can you give an code example that you *would* > recommend for someone looking to do what mixin classes do? Since the language we have does have mult

Re: Mixin classes and single/multiple inheritance

2007-09-19 Thread Ben Finney
Michele Simionato <[EMAIL PROTECTED]> writes: > Ben Finney wrote: > > What do you see as an appropriate use of mixin classes, and what > > an abuse? > > An example of fine usage of mixin is Tkinter; an example of bad > usage if Zope 2. Which parts of those two very large code sets do I need to l

Re: Mixin classes and single/multiple inheritance

2007-09-19 Thread Ben Finney
Michele Simionato <[EMAIL PROTECTED]> writes: > It is already possible to use a syntax like this > > class MyClass(Base): > mixin(Mixin1, Mixin2, ...) > > using P.J. Eby's trick for implementing what he calls class > decorators (see also > http://www.phyast.pitt.edu/~micheles/python/classin

Re: Mixin classes and single/multiple inheritance (was: super() doesn't get superclass)

2007-09-19 Thread Michele Simionato
On Sep 20, 4:55 am, Ben Finney <[EMAIL PROTECTED]> wrote: > Michele Simionato <[EMAIL PROTECTED]> writes: > > I am not against mixins (even if I am certainly very much against > > the *abuse* of mixins, such as in Zope 2). What I would advocate > > (but I realize that it will never happen in Python

Mixin classes and single/multiple inheritance (was: super() doesn't get superclass)

2007-09-19 Thread Ben Finney
Michele Simionato <[EMAIL PROTECTED]> writes: > I am not against mixins (even if I am certainly very much against > the *abuse* of mixins, such as in Zope 2). What I would advocate > (but I realize that it will never happen in Python) is single > inheritance + mixins a la Ruby. For those unfamili