[pylucene-dev] iteration and downcasting...

Bill Janssen janssen at parc.com
Mon Nov 26 14:19:18 PST 2007


I seem to have a lot of this in my JCC PyLucene code:

    # don't use iteration because it doesn't downcast properly
    # for hit in hits:
    for i in range(len(hits)):
        doc = hits.doc(i)

Instead of

    for hit in hits:
        doc = hit.getDocument()

which I'd prefer.  Am I doing something wrong?

Bill


More information about the pylucene-dev mailing list