Python's super() considered super!

Chris Angelico rosuav at gmail.com
Fri May 27 14:46:12 EDT 2011


On Sat, May 28, 2011 at 4:31 AM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
> It seems to me that the example of combining built-in dictionary
> classes is naively optimistic.

So... Can anyone offer a non-trivial example of multiple inheritance
that *doesn't* have pitfalls? From what I've seen, MI always seems to
require cooperation from the authors of all involved classes. It may
be a useful tool when you control everything, but whenever you use
someone else's code, there seems to be this massive barrier of risk
(if that makes sense). For the DefaultOrderedCounter, I would be
strongly inclined to inherit singly, and then manually implement the
other half (whichever half is easier); in this case that happens to be
trivial (override __missing__), but even were it not, it would be a
means of being certain that things won't break.

Chris Angelico



More information about the Python-list mailing list