[Python-3000] PEP 3100 Comments

Jim Jewett jimjjewett at gmail.com
Wed May 10 20:09:22 CEST 2006

On 5/10/06, Bill Janssen <janssen at parc.com> wrote:

> > It only lets you inherit behaviour to new subclasses

> Not that it matters, but...  Yes, that's right.  In systems like
> these, that's how you "add functionality to already existing classes";
> you mix them with the new functionality into a new type.

The problem with this is that

(1)  Existing objects already have a class, so you can't add behavior
to old objects.
(2)  Existing factories put out the old class, so you can't add
behavior to new objects.

For instance, it is theoretically possible to create an object whose
__dict__ is a subclass of dict.  In practice, it isn't so easy.  (2.5
changed the implementation of dict itself to support this, and I'm
still not sure how to actually do it cleanly.)


More information about the Python-3000 mailing list