[Python-Dev] Capabilities

Jim Fulton jim@zope.com
Mon, 10 Mar 2003 10:40:08 -0500

Ka-Ping Yee wrote:
> On Sun, 9 Mar 2003, Guido van Rossum wrote:
>>- Which attributes are considered introspective?
> Here's a preliminary description of the boundary between "introspective"
> and "restricted", off the top of my head:
>     1.  The only thing you can do with a bound method is to call it
>         (bound methods have no attributes except __doc__).

Well, I see no harm and much usefulness
in allowing __name__, __repr__, and __str__.

>     2.  The following instance attributes are off limits:
>         __class__, __dict__, __module__.
> That might be a reasonable start.

I generally want to be able to get the __class__. This is harmless
in my case, because I get a proxy back.

> However, there is still the problem that the established technique
> for storing instance-specific state in Python is to use globally-
> accessible data attributes instead of a limited scope.  We would
> also need to add a safe (private) place for instances to put state.

I'm don't understand why this is necessary. In general, you want to
restrict what attributes (data, properties, methods, etc.) are accessible
in certain situations. I don't follow what makes data attributes special.


Jim Fulton           mailto:jim@zope.com       Python Powered!
CTO                  (888) 344-4332            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org