Re: trellis attrs

PJ Eby <pje-Wh6+Hckhi6HFNGf7iClzIwC/[email protected]> Fri, 30 Sep 2011 12:57:03 -0400
Newsgroups gmane.comp.python.peak
Message-ID <CALeMXf4wnUQvPimv2rJQkE6HoYu2MgbgsXkh4XRUKnGU+FUA7Q@mail.gmail.com>
On Fri, Sep 30, 2011 at 8:05 AM, nicky van foreest <[email protected]>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?

_______________________________________________
PEAK mailing list
[email protected]
http://www.eby-sarna.com/mailman/listinfo/peak