Python recipes: list mixin, improved timeit, etc

B

barnesc

So mixins are just a sub-class [pun intended] of sub-classing?

I've just found this:

A mixin class is a parent class that is inherited from - but not as
a means of specialization. Typically, the mixin will export services to a
child class, but no semantics will be implied about the child "being a
kind of" the parent.
[end quote]

from http://c2.com/cgi/wiki?MixIn

Is that all they are?

It is amazing how you can take the simplest concept, and by using
appropriate terminology, make it as confusing and opaque as you want...

*wink*

"A mixin is an atomic unit in an object-oriented language that adds
functionality to another class."

- http://www.macromedia.com/support/documentation/en/flex/1/mixin/
mixin2.html#118542

The only experience I've had with mixins is in Python, where
UserDict has a class DictMixin that defines the full dictionary
interface from a minimal subset of dictionary methods.

The Python docs don't define mixin. I just assumed this was a case
where a programmer needed a name more descriptive than foo, so he
called it mixin, and that stuck. :)

- Connelly Barnes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top