# - - - S l o t . _ _ g e t i t e m _ _
def __getitem__ ( self, k ):
'''Return the coord of the [k]th character of this slot.
'''
There are two cases:
For a horizontal slot, the result is at row self.origin[0], column self.origin[1]+k.
For a vertical slot, the result is at row self.origin[0]+k, column self.origin[1].
Assuming that self.isV is either 0 or 1,
then perpendicutal(self.isV) is 0 for
horizontal, 1 for vertical; see Section 12, “perpendicular(): Return the opposite
orientation”. This transform allows us to
generalize the logic to a single case.
#-- 1 --
# [ if self.isV is 0 ->
# return Coord ( self.origin[0]+k, self.origin[1] )
# else if self.isV is 1 ->
# return Coord ( self.origin[0], self.origin[1]+k ) ]
return Coord ( self.origin[0] + k*self.isV,
self.origin[1] + k*perpendicular(self.isV) )