Mixin classes and single/multiple inheritance

Ben Finney bignose+hates-spam at benfinney.id.au
Wed Sep 19 23:41:06 EDT 2007


Michele Simionato <michele.simionato at gmail.com> 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/classinitializer.html)
> 
> But I would not use it, let's use the language we have, not
> to invent our own.

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?

-- 
 \           "In case you haven’t noticed, [the USA] are now almost as |
  `\       feared and hated all over the world as the Nazis were."  -- |
_o__)                                              Kurt Vonnegut, 2004 |
Ben Finney



More information about the Python-list mailing list