[Python-Dev] Capabilities

Samuele Pedroni pedronis@bluewin.ch
Mon, 10 Mar 2003 19:53:08 +0100


From: "Jim Fulton" <jim@zope.com>
>
> Could you explain why you say that zope proxies are brittle?
>

from my small experience playing with RestrictedIntepreter:

you wrap into proxies a lot of builtins:

*) 'object' for example, then
class C(object): ... does not work

but given that some basic types are left alone, one can use
Type = ''.__class__.__class__

class C:
  __metaclass__ = Type

*) iter seems not to work (deliberate decision or bug?)
*) proxied 'property' is unusable
*) built-in functions return proxies even if the argument were unproxied:

_12 = map(None,[1,2])

class A: pass
a = A()
a.a = [1,2]

_12 = getattr(a,'a')

in both cases with the proxied version of map and getattr the result _12 would
be a proxied list.

deliberate safer-side decisions?

I can see it both ways:
- see other mail

- map(None,[obj])[0] becomes a way to get a a proxied version of obj that can
be passed to code that would maybe unwrap it and believe
that is some other legit object.

regards.