Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Python recipes: list mixin, improved timeit, etc

Thread Tools

Python recipes: list mixin, improved timeit, etc
Posts: n/a

>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]
>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...

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


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
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
ActiveState/O'Reilly Launch New and Improved Code Share Site (Python) Bret Python 0 02-19-2010 10:18 PM
Re: PIL (etc etc etc) on OS X Kevin Walzer Python 4 08-13-2008 08:27 AM
SPE 0.7.5.e - Python IDE with improved uml, debugger & unicode support SPE - Stani's Python Editor Python 0 11-02-2005 08:25 PM
Python recipes: list mixin, improved timeit, etc Python 8 10-07-2005 01:50 PM
Python Audio (Alpy, Fastaudio, Etc Etc) Daniel Joyce Python 1 09-16-2003 08:39 PM