[Zope-dev] Re: ComputedAttribute
Chris Withers
chrisw@nipltd.com
Wed, 10 Jan 2001 16:13:49 +0000
Martijn Pieters wrote:
>
> Erm. The ExtensionClass.stx documentation hints at a ComputedAttribute
> class (but as an example of how you could use an ExtensionClass). The
> current C implementation of ComputedAttribute is not, as far as I can see,
> documented.
Now I think I know the answer to this one, but I'll ask just to be sure:
class MyClass(Persistent Acquisition.Explicit):
def _set_your_attribute (self,value):
self._v_your_attribute = value
def _get_your_attribute (self):
return self._v_your_attribute
your_attribute = ComputedAttribute(_get_your_attribute)
...with this class, your_attribute isn't going to play in Persistence,
is it? (so I can update it lots without worrying about ZODB size
growing... :-)
Hmm... more questions:
If I do:
x = MyClass()
x.your_attribute = 1
...what happens?
Where do you import the ComputedAttribute module from?
cheers,
Chris