Next / Previous / Contents / Shipman's homepage

11.2. KwicRef.__cmp__(): Comparator

This method defines the order in which KwicRef instances are sorted; see Section 8.1, “ref-key for the explanation.

kwic.py
# - - -   K w i c R e f . _ _ c m p _ _

    def __cmp__(self, other):
        '''Comparator.
        '''
        return cmp(self.__key, other.__key)