Gary Poster wrote:

Okay, so I want a persistent, ordered sequence which is quick to find items in and which doesn't re-store the whole sequence when an item is inserted or removed.

What should I be using?

Ordered, as in sorted?  Or ordered, as in user-determined order?

Ordered as in sorted, thankfully :-)

If sorted, use BTreeSet (or the keys of a BTree).

As in OOTreeSet, right?

Even though my assertion is right semantically for "Set", this is a BTreeSet, and I don't see this behavior changing ever.


No, it isn't a sequence, so `reversed` won't work, but `list` will always give you the same order.

Well, you can iterate over it...

Am I right in thinking I can get the reversed semantics I want by negating the numeric part of insert?

s = OOTreeSet()

...I just have to remember to re-negate them when I get 'em out?

"Set" does not match the "doesn't re-store the whole sequence when an item is inserted or removed" requirement.

But OOTreeSet does, right?

In both cases, IMO you'll want your data to be of homogenous types.

Yep, DateTimes all the way, or if you can't negate them, DateTime.timeTime's



Simplistix - Content Management, Zope & Python Consulting

Zope-Dev maillist  -
**  No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to