[PEAK] trellis attrs

PJ Eby pje at telecommunity.com
Fri Sep 30 12:57:03 EDT 2011


On Fri, Sep 30, 2011 at 8:05 AM, nicky van foreest <vanforeest at gmail.com>wrote:

> I tried the following, but this failed.
>
> class Batch(trellis.Component):
>    trellis.attrs(
>        prevs = trellis.Set([],
>        duration = 0,
>    )
>  ...
>  The problem is that all batches use the same trellis.Set, but I want
> each batch to have its own trellis.Set. How can I achieve this?


I'll go ahead and just answer this bit, because it's the part I can
understand without more detailed study.  Hopefully it'll get you what you
need.  ;-)

Do this:

class Batch(trellis.Component):
     prevs = trellis.make(trellis.Set)
     duration = trellis.attr(0)



>  (I know that removing an item from a trellis.set is impossible.


Uh, what?  Where'd you get that idea?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.eby-sarna.com/pipermail/peak/attachments/20110930/10246ba8/attachment.html


More information about the PEAK mailing list