[Python-3000] Traits/roles instead of ABCs

Steven Bethard steven.bethard at gmail.com
Mon Apr 30 20:21:24 CEST 2007


On 4/30/07, Collin Winter <collinw at gmail.com> wrote:
> On 4/30/07, Steven Bethard <steven.bethard at gmail.com> wrote:
> > On 4/30/07, Collin Winter <collinw at gmail.com> wrote:
> > > No existing mechanism would allow PEP 3141 to be distributed as a
> > > third-party module and still impact the built-in types; that's what
> > > this whole business of __isinstance__ and __issubclass__ is about. In
> > > order to achieve dynamic composition, we're having to monkey with
> > > fundamental, bedrock properties of inheritance-based object
> > > orientation. The definition of "subclass" and "instance" is no longer
> > > objective; the answer to "is X an instance of Y?" becomes, "I dunno,
> > > ask Y".
> >
> > I guess I don't understand why this bothers you more than how you can
> > currently mess with __class__::
> [snip]
> > Maybe you could give a couple realistic examples of where you think
> > people using __isinstance__ and __issubclass__ are going to break
> > things unintentionally?
>
> You assume that being able to change __class__ doesn't bother me: it
> does. The thing that mitigates my unease is that it comes with a
> gigantic red flag that boils down to, "Don't even think about this
> unless you're implementing proxy objects".

Ahh.  I guess I see __isinstance__ and __issubclass__ as having
gigantic red flags saying "Don't even think about these unless you're
implementing ABCs". ;-)

STeVe
-- 
I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
        --- Bucky Katt, Get Fuzzy


More information about the Python-3000 mailing list