On 4/30/07, Collin Winter <[EMAIL PROTECTED]> 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__::

    >>> class X(object):
    ...     __class__ = property(lambda self: Y)
    ...
    >>> class Y(object):
    ...     pass
    ...
    >>> isinstance(X(), Y)
    True

The X class does *not* inherit from the Y class, yet it tells us that
it does. To me, that certainly looks like "monkey[ing] with
fundamental, bedrock properties of inheritance-based object
orientation".

Maybe you could give a couple realistic examples of where you think
people using __isinstance__ and __issubclass__ are going to break
things unintentionally?

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
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to