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

Jim Jewett jimjjewett at gmail.com
Fri Mar 18 16:25:57 CET 2011


On Fri, Mar 18, 2011 at 9:58 AM, Mike Graham <mikegraham at gmail.com> wrote:
> On Fri, Mar 18, 2011 at 8:59 AM, Jim Jewett <jimjjewett at gmail.com> wrote:
>> On Thu, Mar 17, 2011 at 9:48 AM, Mike Graham <mikegraham at gmail.com> wrote:
>>> ... "Why do we ever do mixins through inheritance?"

>> (a)  So we can do an isinstance check

> (a) is a misfeature. isinstance checks are bad:
...
> supporting-all-ordering-operations isn't a meaningful
> abstract category. It would also exclude all those
> classes that already exist and implement all six
> operators.*

Are there some limits to  __instancecheck__ and __subclasscheck__ that
I just haven't run into yet?  Why not write them to say "yes" if all
six operations are available?

-jJ



More information about the Python-ideas mailing list