Next / Previous / Contents / Shipman's homepage

70. WordBank.genSlotChoices(): What words are choices for a slot?

# - - -   W o r d B a n k . g e n S l o t C h o i c e s

    def genSlotChoices ( self, slot ):
        '''Generate the words that are still choices for a given slot.
        #-- 1 --
        return iter ( self.__choiceMap[slot] )

Because self.__choiceMap[slot] is a list of the Word choices for that slot, it is sufficient to return an iterator for that list. This allows the caller to iterate over the choices, but does not allow modification of the list.