Samuele Pedroni wrote:
From: "Ka-Ping Yee" <ping@zesty.ca>
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.
Indeed, that's the fact that implementations of methods are normal functions that access the instance attributes like everything else do, that's why Zope-proxies become necessary (and a bit brittle):
class A: def geta(self): return self.a # 1
a=A()
a.a # 2
(1) and (2) are using the same operation/execution path.
This points out a nice feature of zope proxies. The proxied object's methods are called with an unproxied self, so you can easily allow access to the object's methods without providing access to other attributes. Or, equivalently, you can provide access to one set of methods and those methods can use other methods that you don't provide access to. Could you explain why you say that zope proxies are brittle? Jim -- 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