Next / Previous / Contents / Shipman's homepage

10.4. KwicWord.genRefs(): Disgorge the references

kwic.py
# - - -   K w i c W o r d . g e n R e f s

    def genRefs(self):
        '''Generate self's contained KwicRef instances.
        '''

We use the KwicRef class's comparator to sort the references; see Section 11.2, “KwicRef.__cmp__(): Comparator”.

kwic.py
        #-- 1 --
        for ref in sorted(self.__refList):
            yield ref

        #-- 2 --
        raise StopIteration