[Zope-dev] difference between OOSet and OOTreeSet?

Martin Aspeli optilude at gmx.net
Thu Mar 1 12:26:09 EST 2007




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 http://docs.python.org/lib/types-set.html:

"A set object is an unordered collection of immutable values."

Which makes sense. Sets in the mathematical sense are not ordered either,
nor are sets in other languages (notably Java's Collections API), nor is
zope.schem.Set. Tuples and Lists are ordered.

Sets may turn out to be *sorted* if they're implemented with trees, but I
don't think the implementation promises that either.

Martin

-- 
View this message in context: http://www.nabble.com/difference-between-OOSet-and-OOTreeSet--tf3327097.html#a9254167
Sent from the Zope - Dev mailing list archive at Nabble.com.



More information about the Zope-Dev mailing list