Hi Phillip,<br><br>I tried a naive <br><br>fitered_records = [r for r in records if &quot;some segment&quot; in <a href="http://r.name">r.name</a>]<br><br>It didn&#39;t work :)<br>I get:<br>peak.events.trellis.InputConflict: (Set([]), [])<br>
<br>as for changes, here is the code:<br><br>&nbsp;&nbsp;&nbsp; @trellis.observer<br>&nbsp;&nbsp;&nbsp; def updateView(self):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; x = len(self.records) # needed to monitor changes<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if self.sorted_records:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.txt.Clear()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for r in self.sorted_records:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.txt.AppendText(self.fmt.format(r)+&quot;\n&quot;)&nbsp; <br><br>if I remove the first line in the method the observer no longer gets triggered. <br>In all cases the only thing that changes are new record being added to the records set.<br>
<br>Peter<br><br><div class="gmail_quote">On Wed, Apr 16, 2008 at 6:19 PM, Phillip J. Eby &lt;<a href="mailto:pje@telecommunity.com">pje@telecommunity.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">At 11:32 AM 4/16/2008 +0300, Peter Damoc wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hello,<br>
<br>
I have an app where I use a trellis.Set to hold some records, a trellis.SortedSet to keep them in order but now I need to filter the records based on some criteria.<br>
<br>
records = trellis.Set()<br>
filtered_records = trellis.???<br>
sorted_records = trellis.SortedSet(data=filtered_records)<br>
<br>
How can I do this?<br>
</blockquote>
<br></div>
In the simple case, you could just write a rule that returns a new set. &nbsp;If you want to be more sophisticated, you can write a rule that adds or deletes records in filtered_records using records.added and records.deleted.<div class="Ih2E3d">
<br>
<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Also, if I have an observer that watches over sorted_records, shouldn&#39;t it be triggered if a change in the &nbsp;underlying set is made?<br>
</blockquote>
<br></div>
Yes. &nbsp;Of course, by &quot;change&quot; here, it would mean additions or removals from the set, not changes to mutable values associated with those objects. &nbsp;SortedSet is intended for sets of immutable objects at the present time.<br>

<br>
</blockquote></div><br><br clear="all"><br>-- <br>There is NO FATE, we are the creators.