[PEAK] trellis question

nicky van foreest vanforeest at gmail.com
Sat Jul 16 17:33:27 EDT 2011


In trying to understand the trellis code I made the following simple example:

from peak.events import trellis

class H(trellis.Component):
        a = 0,

class Sum(trellis.Component):
        tot = lambda self: sum(h.a for h in self.h),

    def __init__(self, h):
        self.h = h

L = []
for i in range(9):
    h = H()
    h.a = i

s = Sum(L)
print s.tot

I wonder how trellis finds out that Sum.tot needs h.a for all the h's
in the list. How does it know, for instance, that h.a in the list
comprension sum( h.a for h in self.h) corresponds to a Cell? (Is
actually h.a stored/corresponds to a Cell?)

Thanks in advance.


More information about the PEAK mailing list