[Python-3000] PEP 3133: Introducing Roles

Guido van Rossum guido at python.org
Wed May 16 00:39:59 CEST 2007

On 5/15/07, Collin Winter <collinw at gmail.com> wrote:
> This is what I don't understand: ABCs require changing the VM, roles
> don't; all that change buys you is the ability to spell "performs()"
> as "isinstance()". Why are ABCs preferable, again?

Actually, if you didn't care about overloading isinstance(), you could
have everything else in PEP 3119 by using a different spelling than
isinstance(). Suppose the playing field were to be leveled like this
-- IMO ABCs would still be preferable because they can *also* be
subclassed directly and provide concrete or partially-implemented
methods, acting as mix-in classes. You can also turn it around. If
Roles were overloading isinstance() -- how would they be better than

But I *like* overloading isinstance(), because it means there's less
to learn, and so does Phillip -- it means there can be a uniform way
for the GF machinery to talk about the relationships between instances
and the various things that can be used as argument annotations (even
zope.interfaces could overload isinstance() to do the right thing).

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-3000 mailing list