Needed: Real-world examples for Python's Cooperative Multiple Inheritance

Raymond Hettinger raymond.activestate at gmail.com
Thu Nov 25 17:40:41 EST 2010


On Nov 24, 9:16 pm, Alice Bevan–McGregor <al... at gothcandy.com> wrote:
> On 2010-11-24 12:08:04 -0800, Raymond Hettinger said:
>
> > I'm writing-up more guidance on how to use super() and would like to
> > point at some real-world Python examples of cooperative multiple
> > inheritance.
>
> The SocketServer module
> (http://docs.python.org/library/socketserver.html) uses cooperative
> multiple inheritance to implement threading / async using a
> ThreadingMixIn class and multi-processing using a ForkingMixIn class,
> which may not be as complicated a use case as you are looking for.

It is a great example of a style of using mixins, but isn't
actually an example of Python's cooperative multiple inheritance.
The code doesn't use super() and doesn't have a diamond problem.

It's hard to write a best practices document for super() when
the doesn't appear to be any practice at all :-)


Raymond






More information about the Python-list mailing list