[Python-ideas] mixins as decorators vs inheritance [was: Automatic comparisons by default]

Jim Jewett jimjjewett at gmail.com
Fri Mar 18 13:59:54 CET 2011


On Thu, Mar 17, 2011 at 9:48 AM, Mike Graham <mikegraham at gmail.com> wrote:
> On Wed, Mar 16, 2011 at 5:48 PM, Masklinn <masklinn at masklinn.net> wrote:
>> (also, since I apparently completely missed this,
>> what was the rationale of making it a class
>> decorator rather than, say, a mixin?)

> Perhaps the better question is "Why do we ever
> do mixins through inheritance?"

That is a good question, and I was tempted to switch,
until I realized that there are some good answers...

(a)  So we can do an isinstance check
(b)  So we can more easily override parts of the mixin

-jJ



More information about the Python-ideas mailing list