On Mar 2, 2007, at 2:42 AM, Chris Withers wrote:

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?

Yeah, that would work.

"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

Cool. I doubt you can negate the old Zope DateTimes, but who knows what tricks that class has up its sleeve. ;-)


Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )

Reply via email to