[Zope-CVS] CVS: Products/ZCTextIndex - BaseIndex.py:1.11

Tim Peters tim@zope.com
Fri, 17 May 2002 12:03:25 -0400


[Jeremy Hylton]
> ...
> Add XXX comment about the purpose of the try/except(s) in
> _del_wordinfo().  I suspect they only existed because _del_wordinfo()
> was called repeatedly when a wid existed more than once.

I believe that's right -- go for it <wink>.

> +def unique(l):
> +    """Return a list of the unique elements in l."""
> +    d = {}
> +    for elt in l:
> +        d[elt] = 1
> +    return d.keys()

I think Python should say "l" isn't a valid identifier <0.5 wink>.

This *may* be a lot quicker:

def unique(L):
    return IITreeSet(L)

"It works", and so does IISet(L), but I'm not clear on the difference
between an IITreeSet and an IISet.  Maybe the latter is a one-bucket-only
gimmick (in which case its worse case for removing dups would be atrocious);
maybe not.