Next / Previous / Contents / Shipman's homepage

32. Puzzle.whatCell(): Is there a cell at a given coordinate?

# - - -   P u z z l e . w h a t C e l l

    def whatCell ( self, coord ):
        '''Is there a cell at a given location?

Recall, as discussed in Section 13, “class Puzzle: The top-level container”, that the .__cellMap dictionary is indexed not by Coord instances, but by (row, column) tuples.

        #-- 1 --
            return self.__cellMap[(coord[0], coord[1])]
        except KeyError:
            return None