Python recipes: list mixin, improved timeit, etc
Michele Simionato
michele.simionato at gmail.com
Fri Oct 7 08:58:49 EDT 2005
Paul Rubin wrote:
> 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.
I don't think Python approach to multiple inheritance is cavalier (you
may want
to clarify that statement). In CLOS multiple inheritance is less of a
problem
since (multi)methods are defined outside classes. One could argue that
using classes also as a scope-control mechanism (i.e. doing the job of
modules) is an abuse.
> 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.
Nowadays I tend to use delegation via __getattr__ instead of multiple
inheritance.
Michele Simionato
More information about the Python-list
mailing list