Re: [Zope-dev] difference between OOSet and OOTreeSet?

2007-03-02 Thread Chris Withers
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

Re: [Zope-dev] difference between OOSet and OOTreeSet?

2007-03-02 Thread Gary Poster
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

Re: [Zope-dev] difference between OOSet and OOTreeSet?

2007-03-01 Thread Martin Aspeli
Chris Withers wrote: Hi All, Wondering if someone could tell me the difference between an OOSet and an OOTreeSet? They seem to have different interfaces and yet seem to be used in similar circumstances in PluginIndexes/common/UnIndex.py... I'm looking for a set-like data

Re: [Zope-dev] difference between OOSet and OOTreeSet?

2007-03-01 Thread Gary Poster
On Mar 1, 2007, at 9:04 AM, Chris Withers wrote: Hi All, Wondering if someone could tell me the difference between an OOSet and an OOTreeSet? They seem to have different interfaces and yet seem to be used in similar circumstances in PluginIndexes/common/UnIndex.py... I'm looking for a

Re: [Zope-dev] difference between OOSet and OOTreeSet?

2007-03-01 Thread Chris Withers
Martin Aspeli wrote: I'll bet one is backed by a hashtable and the other is backed by an r/b tree, meaning the Set is O(1) lookups, possibly a bit less space efficient and non-ordered, Well, Set's are definitely ordered, same as normal python sets... Chris -- Simplistix - Content

Re: [Zope-dev] difference between OOSet and OOTreeSet?

2007-03-01 Thread Chris Withers
Hi Gary, Gary Poster wrote: What should I be using? TreeSet. Interesting, okay, so how should I work around this bogosity? Is this a bug? from BTrees.OOBTree import OOTreeSet,OOSet for i in OOSet((1,2,3)): print i, 1 2 3 for i in OOTreeSet((1,2,3)): print i, 1 2 3 for i in

Re: [Zope-dev] difference between OOSet and OOTreeSet?

2007-03-01 Thread Andreas Jung
--On 1. März 2007 09:52:53 + Chris Withers [EMAIL PROTECTED] wrote: Martin Aspeli wrote: I'll bet one is backed by a hashtable and the other is backed by an r/b tree, meaning the Set is O(1) lookups, possibly a bit less space efficient and non-ordered, Well, Set's are definitely

Re: [Zope-dev] difference between OOSet and OOTreeSet?

2007-03-01 Thread Martin Aspeli
Chris Withers wrote: Martin Aspeli wrote: I'll bet one is backed by a hashtable and the other is backed by an r/b tree, meaning the Set is O(1) lookups, possibly a bit less space efficient and non-ordered, Well, Set's are definitely ordered, same as normal python sets... From

Re: [Zope-dev] difference between OOSet and OOTreeSet?

2007-03-01 Thread Gary Poster
On Mar 1, 2007, at 12:01 PM, Chris Withers wrote: Hi Gary, Gary Poster wrote: What should I be using? TreeSet. Interesting, okay, so how should I work around this bogosity? Is this a bug? from BTrees.OOBTree import OOTreeSet,OOSet for i in OOSet((1,2,3)): print i, 1 2 3 for i in

Re: [Zope-dev] difference between OOSet and OOTreeSet?

2007-03-01 Thread Fred Drake
On 3/1/07, Martin Aspeli [EMAIL PROTECTED] wrote: Sets may turn out to be *sorted* if they're implemented with trees, but I don't think the implementation promises that either. The BTrees implementation definitely does promise the sorting relationship for the results of iteration, which is

Re: [Zope-dev] difference between OOSet and OOTreeSet?

2007-03-01 Thread Chris Withers
Gary Poster wrote: Traceback (most recent call last): File stdin, line 1, in ? TypeError: argument to reversed() must be a sequence The fact that this works for the OOSet is an implementation accident. As discussed elsewhere in this thread, sets are not sequences. The fact that the

Re: [Zope-dev] difference between OOSet and OOTreeSet?

2007-03-01 Thread Gary Poster
On Mar 1, 2007, at 3:18 PM, Chris Withers wrote: Gary Poster wrote: Traceback (most recent call last): File stdin, line 1, in ? TypeError: argument to reversed() must be a sequence The fact that this works for the OOSet is an implementation accident. As discussed elsewhere in this thread,

Re: [Zope-dev] difference between OOSet and OOTreeSet?

2007-03-01 Thread Tim Peters
[Chris Withers] Wondering if someone could tell me the difference between an OOSet and an OOTreeSet? OOSet is to OOTreeSet as OOBucket is to OOBTree. An OOTreeSet is built out of leaf-level OOSets in exactly the same way an OOBTree is built out of leaf-level OOBuckets. More at: