Commit 9b736188 authored by Jeremy Hylton's avatar Jeremy Hylton

Implement unique using an IITreeSet as suggested by Tim.

parent 0d93f320
......@@ -18,7 +18,7 @@
import math
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 @@ def scaled_int(f, scale=SCALE_FACTOR):
# 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):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment