On 1/17/07, Don Taylor <[EMAIL PROTECTED]> wrote:
> So, what constitutes a mixin class and what are the conventional ways to
> denote them in code?

A mixin is a specific type of superclass, just called a mixin because
of the concept it represents. A common type of mixin would be a class
that defines some sort of modified functionality intended to be given
to multiple, not necessarily related classes.

Say you wanted all your classes to have a similar looking format when
"print"ed. You could define a mixin class that defined a special
__repr__ method. A detailed  example of this is demonstrated in
/Learning Python/ by Lutz & Ascher.

There's no need to explicitly state that they are a mixin class, but
if you felt the need to, you could either put it in a comment or,
probably even better, in the mixin's docstring.

Chris
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to