Python recipes: list mixin, improved timeit, etc
Fri Oct 7 14:26:28 CEST 2005
"Michele Simionato" <michele.simionato at gmail.com> writes:
> Once in a time, I thought mixins where a good idea; now I don't think
> so since they are too easily abused (see Zope 2) and as a consequence
> you get spaghetti-inheritance, where you have objects with methods
> inherited from everywhere. So be very careful if you want to use
> mixins; often you can go without them.
Yeah, I wonder though how much of that is a result of Python's
cavalier approach to multiple inheritance. Does that happen much in
CLOS? In Java because of multiple interfaces? I've studied Flavors a
little and mix-ins were used in some extensive ways, but maybe
programs using them required extra care.
The Python tutorial does caution against indiscriminate use of
multiple inheritance. I tried coding something without it, wished
that I'd used it and did so in the next version, but still am not sure
if I gained anything or not.
More information about the Python-list