Python recipes: list mixin, improved timeit, etc

Steven D'Aprano steve at
Fri Oct 7 14:24:49 CEST 2005

On Thu, 06 Oct 2005 21:03:33 -0700, barnesc wrote:

> I added some recipes to the Python Cookbook:
>  - listmixin
>    Use ListMixin to create custom list classes from a small subset of
>    list methods:

That looks great. Now, if only I understood mixins: what are they, and
what they are for, and in particular, how they differ from mere

I've spent some time searching for a good definition on the web, but the
main problem I've found is that most discussions on mixins assume
you already know what they are. Those that don't are talking about
Ruby or Lisp or some other language other than Python. I don't speak
those languages, so their code examples don't make a lot of sense to me.

Anyhoo, I've struggled on, but obviously I Just Don't Get It because
using mixins looks like subclassing to me.

Can anyone help me understand what's going on?



More information about the Python-list mailing list