[Zope-dev] strange priv leak

Guido van Rossum guido@python.org
Fri, 23 May 2003 09:40:37 -0400


> We don't need instances of built-in types to allow extra attributes.
> So, no need to say {}.__roles__ = something. What we would need is to be 
> able to say dict.__roles__ = something.
> 
> It would be nice if the objects that represent built-in types could have 
> attributes set on them. This would be helpful for some things in Zope 3 too.

There are important reasons why I don't want this, and in fact will go
to great lengths to prevent this.  Reason 1: multiple interpreters
share the built-in type objects, and modifying a built-in type will
affect all interpreters.  Reason 2: if this were allowed, people
*will* abuse it to change the behavior of built-in types to suit their
purposes, and then they will be disappointed when they break standard
library stuff that they don't realize they need.  So better put a stop
to that.

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