[PEAK] How do I extract a subset?

Phillip J. Eby pje at telecommunity.com
Wed Apr 16 14:32:34 EDT 2008


At 08:06 PM 4/16/2008 +0300, Peter Damoc wrote:
>Hi Phillip,
>
>I tried a naive
>
>fitered_records = [r for r in records if "some segment" in 
><http://r.name>r.name]
>
>It didn't work :)
>I get:
>peak.events.trellis.InputConflict: (Set([]), [])

You've left out any information that would help me know what the heck 
is going on with this bit.  Like the traceback, and the code.  :)


>as for changes, here is the code:
>
>     @trellis.observer
>     def updateView(self):
>         x = len(self.records) # needed to monitor changes
>         if self.sorted_records:
>             self.txt.Clear()
>             for r in self.sorted_records:
>                 self.txt.AppendText(self.fmt.format(r)+"\n")
>
>if I remove the first line in the method the observer no longer gets 
>triggered.
>In all cases the only thing that changes are new record being added 
>to the records set.

Ah...  you need to be using 'self.sorted_records.changes' in order to 
detect changes in a SortedSet, currently.  Really, that's what 
SortedSet is for, to produce a position-based change log.




More information about the PEAK mailing list