Re: [Zope-dev] Re: ComputedAttribute

2001-01-11 Thread Steve Alexander
Martijn Pieters wrote: But because _v_* variables don't get pickled, another thread will never see them. If you want non-persisting (volatile) variables shared between threads, you'll have to devise your own mechanism for assuring the thread-safety of those variables. Or, instead of

Re: [Zope-dev] Re: ComputedAttribute

2001-01-10 Thread Chris Withers
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

Re: [Zope-dev] Re: ComputedAttribute

2001-01-10 Thread Martijn Pieters
On Wed, Jan 10, 2001 at 04:13:49PM +, Chris Withers wrote: 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

Re: [Zope-dev] Re: ComputedAttribute

2001-01-10 Thread Chris Withers
Martijn Pieters wrote: ...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... :-) Yup, this allows you to alias your_attribute to _v_your_attribute without creating an attribute that *will*

Re: [Zope-dev] Re: ComputedAttribute

2001-01-10 Thread Martijn Pieters
On Wed, Jan 10, 2001 at 05:07:07PM +, Chris Withers wrote: If you want _set_your_attribute to be called, you need to override __setattr__: def __setattr__(self, name, value): setter = getattr(self, '_set_' + name, None) if setter: setter(value)

Re: [Zope-dev] Re: ComputedAttribute

2001-01-10 Thread Dieter Maurer
Chris Withers writes: Martijn Pieters wrote: 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

Re: [Zope-dev] Re: ComputedAttribute

2001-01-10 Thread Chris Withers
Chris Withers writes: 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... :-) But, as I understand it, it is only updated in the thread that did the update. Your next request may get a

Re: [Zope-dev] Re: ComputedAttribute

2001-01-10 Thread Martijn Pieters
On Wed, Jan 10, 2001 at 11:09:43PM +0100, Dieter Maurer wrote: Chris Withers writes: 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 =

Re: [Zope-dev] Re: ComputedAttribute

2001-01-10 Thread Martijn Pieters
On Wed, Jan 10, 2001 at 11:37:55PM -, Chris Withers wrote: Chris Withers writes: 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... :-) But, as I understand it, it is only

[Zope-dev] Re: ComputedAttribute

2001-01-05 Thread Martijn Pieters
On Fri, Jan 05, 2001 at 12:22:32PM +, Chris Withers wrote: Martijn Pieters wrote: You could use ComputedAttribute for that: class MyClass(Acquisition.Explicit): # The following attribute is acquired transparently def _acquired_your_attribute(self): return