[ZODB-Dev] Obtaining a subset of BTree items

Christian Robottom Reis kiko at async.com.br
Wed Oct 15 19:51:31 EDT 2003


Let's see if anybody has run into this before. I'm trying to "filter" an
IOBTree by a set of keys. I can cook the keys into an IOSet, but how can
I retrieve the values that correspond to that set of keys?

At the moment, I'm doing

    [tree[i] for i in set]

and then doing a multiunion on the results (since the values are
actually IISets too). But maybe there's an operation I'm missing here,
something that looks like:

    intersection(tree, set) 

but that returns a bucket instead of a set. With the bucket I could just
return values() and then multiunion() that.

I assume it would also be faster than the list comprehension, but maybe
I'm wrong.

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331



More information about the ZODB-Dev mailing list