[Zope-CVS] CVS: Products/ZCTextIndex - BaseIndex.py:1.12
Jeremy Hylton
jeremy@zope.com
Fri, 17 May 2002 13:22:54 -0400
Update of /cvs-repository/Products/ZCTextIndex
In directory cvs.zope.org:/tmp/cvs-serv23911
Modified Files:
BaseIndex.py
Log Message:
Implement unique using an IITreeSet as suggested by Tim.
=== Products/ZCTextIndex/BaseIndex.py 1.11 => 1.12 ===
from BTrees.IOBTree import IOBTree
-from BTrees.IIBTree import IIBTree, IIBucket
+from BTrees.IIBTree import IIBTree, IIBucket, IITreeSet
from Products.ZCTextIndex.IIndex import IIndex
from Products.ZCTextIndex import WidCode
@@ -44,12 +44,9 @@
# expensive.
return int(f * scale + 0.5)
-def unique(l):
- """Return a list of the unique elements in l."""
- d = {}
- for elt in l:
- d[elt] = 1
- return d.keys()
+def unique(L):
+ """Return a list of the unique elements in L."""
+ return IITreeSet(L).keys()
class BaseIndex(Persistent):