Mixin classes and single/multiple inheritance

Ben Finney bignose+hates-spam at benfinney.id.au
Thu Sep 20 00:52:50 EDT 2007


Michele Simionato <michele.simionato at gmail.com> 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 for what concerns cooperative methods.

I may be obtuse, but the above statements seem to be professing
contradictory viewpoints.

Do you think multiple inheritance should or should not be used in
Python to do what mixins do?

> My point was that even if Python had been implemented without
> multiple inheritance, it would have been simple to implement mixins,
> or by copying the methods, or by dispatching with __getattr__.

Can you give a code example of how you think mixins should be
implemented in Python, assuming the absence of multiple inheritance?

-- 
 \          "The best way to get information on Usenet is not to ask a |
  `\            question, but to post the wrong information."  -- Aahz |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list