advice on programming style: is multiple inheritance bad?
Roy Smith
roy at panix.com
Sun Feb 1 19:44:03 EST 2004
Joe Mason <joe at notcharles.ca> wrote:
> When profiling a large app at work, we discovered that in C++ accessing
> every parent class after the first is quite slow. We were able to just
> flip the order of inheritance for some classes, but if you're planning a
> complex use of multiple inheritance you should keep that in mind. (I'm
> just assuming it has the same effect in Python.)
The execution environments of C++ and Python are completely different.
Compiled vs. interpreted. Dynamic vs. static binding. There's no
reason to believe that what's fast or slow in one language should be
fast or slow in the other, especially with such low-level details of how
inheritance works.
Your comment about profiling is a good one, though. If you want to see
what makes an application slow, profile it. Measuring always works
better than guessing. And that's true in any language.
More information about the Python-list
mailing list