# - - - W o r d B a n k . s l o t C h a r C h o i c e s
def slotCharChoices ( self, slot, coord ):
'''Return the set of characters for slot's choices at coord.
'''
#-- 1 --
# [ if coord is in slot ->
# k := index within slot of coord
# else -> raise IndexError ]
k = slot.findCoord ( coord )
Now we iterate over the words that are choices for this
slot (see Section 70, “WordBank.genSlotChoices(): What words
are choices for a slot?”). For
each word, we extract the character at position [k], make it into a singleton set, and then use
the Python reduce() function to form the
union of all those sets; set.__or__ is the
function of the set type that implements the
“|” operator, set union.
#-- 2 --
# [ return the union of the sets of all characters that occur
# in position k of words that are choices for slot ]
wordList = [ set(word[k])
for word in self.genSlotChoices ( slot ) ]
if len(wordList):
return reduce ( set.__or__, wordList )
else:
return set()