[Zope] ComputedAttribute

Gabriel Genellina gagenellina@softlab.com.ar
Tue, 29 Jan 2002 21:31:34 -0300


Hi

What's a "ComputedAttribute"???
I've done my work looking everywhere... Neither the Zope Book nor other 
documents say nothing about it. In Dieter Maurer's book they're menctioned 
but no details.
Searching at zope.org and the mailing list archives, I've just found a few 
references ("a ComputedAttribute is useful here" or things like that), but 
nobody says what a C.A. really is.
Looking at the Zope sources I've found a few modules using it. I guess a 
ComputedAttribute acts like an instance attribute but really it's 
implemented as a method. That would be useful for delegation. But in 
DTMLFile class:

     def _get__roles__(self):
        ... compute something and return that...
     __roles__ = ComputedAttribute(_get__roles__, 1)

what's the second argument?
And, what's the difference with using __getattr__()?


Gabriel Genellina
Softlab SRL